Is there a way to use a variable in the select_statement part of the DECLARE CURSOR?
For instance I would like to do the following
SELECT @SQL = 'SELECT [' + @FieldName + '] FROM [QueryName]'
DECLARE CURSOR_1 CURSOR FOR @SQL
However this does not seem to work. Is there any way to do this? Any help would be greatly appreciated. Thank you.
For instance I would like to do the following
SELECT @SQL = 'SELECT [' + @FieldName + '] FROM [QueryName]'
DECLARE CURSOR_1 CURSOR FOR @SQL
However this does not seem to work. Is there any way to do this? Any help would be greatly appreciated. Thank you.