Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-15 : 10:02:28
|
| FridayNightGeorge writes "Howdy,I need to create a static cursor using a dynamic SQL statement using T-SQL within a stored procedure. I've tried the EXECUTE and sp_executesql commands and they return the right results when I run the statement from within SQL Query Analyzer, but I have no way to access the results from within a stored procedure. My reason for the need of dynamic statements is the flexibility to retrieve different columns based on the current date. Thanks.FridayNightGeorge" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-03-15 : 11:34:28
|
| Well, why a cursor? You can incorporate the dynamic SQL you're using and process the results in a single procedure. If you need to pass the results to another procedure, you can put them into a temp table that the 2nd procedure can access. In any case, you don't need a cursor to do this. If you're processing rows with a cursor, I can guarantee there's a way to do it without a cursor.Can you post your code? It'll be easier for us to help if we see what you have now. |
 |
|
|
|
|
|