SQL Server Performance

Dynamic sql with cursors

Discussion in 'General Developer Questions' started by danny123, Sep 16, 2008.

  1. danny123 New Member

    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!
  2. moh_hassan20 New Member

    [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?

  3. TommCatt New Member

    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.
  4. satya Moderator

  5. FrankKalis Moderator

    Another good reference would be http://www.sommarskog.se/dynamic_sql.html

Share This Page