how do we assign SNOWSQL select query output to an unix variable, i am using below shellscript and trying to assign the output of select statement to variable var2. but somehow it is not working.
#!/bin/ksh
set var2=(snowsql -c newConnection -o log_level=DEBUG -o log_file=~/snowsql_sso_debug.log -r DEV_ACCT_ROLE -w LOAD_WH -d DEV_DB -s CTL_DB -q "select STG_TBL_NAME from CTL_DB.PROC_CTRL WHERE STG_TBL_NAME='TEAM'")
appriciate your quick response. Thanks
I can get the result using $(), but you should also use some additional options to suppresses header, timing, and the startup and exit messages.
https://docs.snowflake.com/en/user-guide/snowsql-config.html#snowsql-configuration-options-reference