How to replace variables in Database Loop SQL

More
9 months 3 weeks ago #25755 by prashant
HI, 
I have a very small script where I am trying to pass a variable 

select * from [items].[dbo].[quickbase_download] where report_id = '#report#';

Conversion failed when converting the varchar value '#report#'' to data type int
I can confirm I am able to pass 72 to #report# and the query works fine as 

select * from [items].[dbo].[quickbase_download] where report_id = '72'; OR
select * from [items].[dbo].[quickbase_download] where report_id = 72';

I have tried this with embedded report and with regular script action too

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #25756 by Peter.Jonson
Please post some screenshots

Peter Jonson
ETL Developer

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #25757 by prashant
 

When I try the database loop I get

 
The following user(s) said Thank You: Peter.Jonson

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #25758 by Peter.Jonson
Please post parameters of database loop

Peter Jonson
ETL Developer

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #25759 by prashant
The same behaviour exists if I try to pass a variable into VARCHAR , substitution of variable is not taking place.

Please Log in or Create an account to join the conversation.

More
9 months 3 weeks ago #25760 by prashant
The following user(s) said Thank You: Peter.Jonson

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save