Hi there, I have 2 cursors in one stored procedure. One cursor create the temp table and other cursor inserts the values in that temp table. Both cursors are using dynamic sql to perform the create and inserts. Now second cursor is not able to find the temp table created in first cursor and giving out the error. Can some one please advice how to work around this issue. Thanks!
[quote user="danny123"]Now second cursor is not able to find the temp table created in first cursor and giving out the error.[/quote] what is the error?
There is a high probability that neither cursors nor dynamic SQL are required. If you can, provide the code and we can look at it.
Danny In such case of solution it is better if you can provide the sample code used here, fyi http://www.sqlservercentral.com/articles/Basic Querying/temptablesinsqlserver/1279/ on usage of temp tables.