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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to set date store procedure argument as nvarchar

Hi there,

I have an SQL store procedure that has a following input parameters:

SET surveyID=111111;

SQL EXEC [dbo].[reportSP_ExportDataFile] @__surveyID = $(surveyID),@__userID = 1,@__langID = 1,

@__startDate= N'2013/05/01',@__endDate=N'2013/06/01';

I would really want to have it dinamic, but cannot set it up like

@__startDate=$(StartDate),@__endDate=$(EndDate);

using the following settings:

SET DateFormat='YYYY/MM/DD';

LET StartDate=Monthstart(today(),-1);

LET EndDate=Monthstart(today());

because I cannot get $(StartDate) and $(EndDate) in the same (nvarchar) format.

Could you please help?

Thank you very much in advance!!!

1 Reply
Not applicable
Author

I found the solution myself:

LET StartDate=chr(39) & text(Monthstart(today(),-1)) & chr(39);

LET EndDate=chr(39) & text(Monthstart(today())) & chr(39);