Quantcast
Channel: Answers for "variable replacement using sp_executesql"
Browsing all 8 articles
Browse latest View live

Answer by Grant Fritchey

You can't pass a table name as a variable in that fashion. You'll still have to build the string and replace the variable with the table name such that when the query executes, it has a table to...

View Article



Answer by ozamora

@Grant is right. And you are close. Replace @myTable with: ' + @myTable + ' and do not pass the @myTable variable anymore

View Article

Answer by Doiremik

thanks Ozamora for the very quick response.. I have amended the code for now like so WITH cte AS ( SELECT CONVERT(VARCHAR(@dateCastLength), QuoteDateTimeUTC, 120 as convertedDate, QuoteDateTimeUTC as...

View Article

Answer by Doiremik

Geeez Ozamora... you rock... top class lol. I know the code is really simple but this isnt the real implementation honest... I'm using CTE's to work out candle stick charts and aggregate data on...

View Article

Answer by Grant Fritchey

You can't pass a table name as a variable in that fashion. You'll still have to build the string and replace the variable with the table name such that when the query executes, it has a table to...

View Article


Answer by ozamora

@Grant is right. And you are close. Replace @myTable with: ' + @myTable + ' and do not pass the @myTable variable anymore

View Article

Answer by Doiremik

thanks Ozamora for the very quick response.. I have amended the code for now like so WITH cte AS ( SELECT CONVERT(VARCHAR(@dateCastLength), QuoteDateTimeUTC, 120 as convertedDate, QuoteDateTimeUTC as...

View Article

Answer by Doiremik

Geeez Ozamora... you rock... top class lol. I know the code is really simple but this isnt the real implementation honest... I'm using CTE's to work out candle stick charts and aggregate data on...

View Article

Browsing all 8 articles
Browse latest View live




Latest Images