Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Unanswered: SP Executed successfully in SSMS but fail in C++/ODBC

    I have an app that run from multiple computers and must synchronize something between its internal database and one database from SQL server.

    I use some temporary tables to insert internal database's data and then call an SP to synchronize data, it will process data row-by-row and then either update them in SQL database, insert new rows or delete dropped rows. Since I should support customers that have SQL server 2000, I should have a solution other than MERGE.

    The problem is my SP work very well in SSMS but it suddenly fail when called from my application, I use C++ native code and use ODBC and SQL Native Client for connection with SQL server.

    I have attached my database creation commands and a simple test case.

    Each time that I execute #SynchronizeP from C++ app I get a sudden error somewhere in between the SP and transaction will be failed, but executing the code in SSMS is perfect. I tried anything but I can't come up with an answer!!
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    I think you're misusing temporary objects. They only exist for the duration of the connection that created them. Once the connection is severed, - they become inaccessible and get cleaned up by the server.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •