Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Jun 13, 2024 10:13:04 AM
May 27, 2022 11:08:55 AM
In order to include SQL SET statements or non select queries in the script depending of the driver configurations might be needed. The following is a basic sample that shows how to include SQL SET statement or non select queries using Qlik ODBC Package and native SQL Native Driver.
The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.
a SET statement is considered a non select query, therefore it needs to be enabled, setting allow-nonselect-queries to true (see instructions here)
in addition it will be necessary to include !EXECUTE_NON_SELECT_QUERY in the query
Simple query
SQL SET ANSI_NULLS ON !EXECUTE_NON_SELECT_QUERY;
SQL SET NOCOUNT ON !EXECUTE_NON_SELECT_QUERY;
SELECT * FROM
master.sys.syslanguages;
If you get syntax errors you can attempt to use a variable
vSQLScript = 'SET NOCOUNT ON !EXECUTE_NON_SELECT_QUERY;
SELECT * FROM
master.sys.syslanguages;';
SQL $(vSQLScript);
If none of the above suggestions worked you might need to use a DB object as a workaround (store procedure, views, etc), this is a sample with an Store Procedure:
SQL EXEC sp_databases;
The driver can be downloaded from Microsoft, make sure is up to date and compatible with your SQL Server DB (ODBC Driver for SQL Server)
Simple query
SQL SET NOCOUNT ON ;
SELECT * FROM
master.sys.syslanguages;
If you get syntax errors you can attempt to use a variable
vSQLScript = 'SET NOCOUNT ON ;
SELECT * FROM
master.sys.syslanguages;';
SQL $(vSQLScript);
If none of the above suggestions worked you might need to use a DB object as a workaround (store procedure, views, etc), this is a sample with an Store Procedure:
SQL EXEC sp_databases;