Click here to Skip to main content
15,889,909 members

Response to: How to use a variable in a select statement for a declare cursor

Revision 1
While you can use EXECUTE[^] to run a dynamic SQL statement, I'm really suspicious if this is a good approach.

If you dynamically define the result set columns wouldn't this result into a situation where you have difficulties in selecting the values from the cursor since you don't know the columns?

Dynamic sql could be feasible when you have changing conditions, but I would consider other kind of approaches for this.
Posted 27-Dec-12 10:21am by Wendelius.