Quantcast
Channel: Answers for "variable replacement using sp_executesql"
Viewing all articles
Browse latest Browse all 8

Answer by Doiremik

$
0
0
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 myconvertedDate FROM TickData.dbo.EURUSD.' + @myTable + ' )..... but it doesnt like the @dateCastLength. If I replace the @dateCastLength with a number like 16 eg CONVERT(VARCHAR(16), QuoteDateTimeUTC, 120) as convertedDate, then it works I have @dateCastLength declared as a varchar so should it be an int instead.. oh ps... when you said variable sub can be used anywhere... thats except in the FROM clause.. is this correct...

Viewing all articles
Browse latest Browse all 8

Trending Articles