none
Extract Identity value inserted by SQLXMLBulkUpload RRS feed

  • Question

  • Is there a way by which I can extract the identity value inserted by my Bulk Upload operation through SQLXMLBulkUpload. I want the identity value inserted back to my code to use it.

    Monday, July 21, 2014 5:59 AM

Answers

  • Hello,

    What is the SQLXMLBulkUpload? Does it a method/property of .NET Framework libraries? I asked because I do not find related information under .NET Framework libraries. I only find the SQLXML Bulk Load which is under SQL Server libraries.

    >> Is there a way by which I can extract the identity value inserted by my Bulk Upload operation through SQLXMLBulkUpload. I want the identity value inserted back to my code to use it.

    We could retrieve it by doing a query to database after the identity value is generated. If your current project works with sql script, you could also use SELECT SCOPE_IDENTITY() which can (and should) be placed directly after the INSERT statement, so it's all done in the same database call as:

    INSERT INTO table(foreign_key1, value) VALUES(9, 'text'); SELECT SCOPE_IDENTITY();

    It would return the generated identity value in one statement.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 22, 2014 3:39 AM
    Moderator