I have an T-SQL script that reads some 660 lines with many occurences of a certain date calculation:
CONVERT(DATETIME, CONVERT(VARCHAR(23), rdb.period_year * 10000 + rdb.period_month * 100 + 1), 112)
[/code]
Where rdb is the table alias used furtheron in the script.
Can I define a variable like:
@date_from_year_month varchar(200)
set @date_from_year_month = 'CONVERT(DATETIME, CONVERT(VARCHAR(23), rdb.period_year * 10000 + rdb.period_month * 100 + 1), 112)'
[/code]
And the use the declared variable in the sql part of the procedure in the next steps?
Ties Blom