I need to execute the following select statement dynamically:
SELECT @RC = count(*)
FROM @sTable
WHERE Calldate = @sCalldate
When I write it like this I get errors..
EXEC ('SELECT ' + @RC + ' = count(*)
FROM ' + @sTable +
' WHERE Calldate = ' + @sCalldate)
IS there any way I can do this to get the count into a variable?
Thanks,
Ninel
SELECT @RC = count(*)
FROM @sTable
WHERE Calldate = @sCalldate
When I write it like this I get errors..
EXEC ('SELECT ' + @RC + ' = count(*)
FROM ' + @sTable +
' WHERE Calldate = ' + @sCalldate)
IS there any way I can do this to get the count into a variable?
Thanks,
Ninel