I need to use a variable as the table name for a select into statement.
set @WEDate = '20071201'
set @PayPrefix = 'XXX'
set @PayTable = 'Pay_'+@PayPrefix+@WEDate
/* @PayTable now = Pay_XXX20071201 */
I think I need to use exec sp_executesql
but need some help on the correct format, unless there is a better way.