Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

SQL semicolon escape

Hi all,

I have an MS SQL query which *must* include a semicolon, however Qlikview is treating this as the end of the SQL script. How can I prevent this?

test:

load *;

SQL

declare @i int

declare @hello nvarchar(20)

declare @hello2 nvarchar(20)

declare @code nvarchar(20)

declare @original nvarchar(20)

declare @counter nvarchar(20)

declare @rownum nvarchar(20)

declare @cachecounter nvarchar(20)

declare @iterate nvarchar(20)

set @iterate=1

set @rownum=1

set @counter=1

set @original=5158

set @code=0

select @i=2

select @cachecounter=count(1) from ErrorForms.dbo.CacheById where Type=6;

with ordered as (select ROW_NUMBER ( )  OVER (Order by Code desc ) as rownumber, Code, Id from ErrorForms.dbo.cachebyid where Type=6)

select @hello=Code from ordered where rownumber=9

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

That's not a query but a procedure. Create a stored procedure in your source database and call the stored procedure from qlikview


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

That's not a query but a procedure. Create a stored procedure in your source database and call the stored procedure from qlikview


talk is cheap, supply exceeds demand
jonathandienst
Partner - Champion III
Partner - Champion III

If that is not an option, does With require a leading semicolon if it is the first expression in a SQL batch? None of the declares, sets or selects before the With do anythng as far as I can see, so if you remove those, you won't need the semicolon.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein