Home Forums SQL Server 7,2000 T-SQL Using a variable as a field value in a bulk insert RE: Using a variable as a field value in a bulk insert

  • I would load the data into a staging table with bulk insert, then insert the date into the batch table, and finally insert the data from the staging table into your Files table with the identity value from the batch table.  BTW, I would use SCOPE_IDENTITY().  From BOL:

    SCOPE_IDENTITY and @@IDENTITY will return last identity values generated in any table in the current session. However, SCOPE_IDENTITY returns values inserted only within the current scope; @@IDENTITY is not limited to a specific scope.

    Luck, Dave

    There is no "i" in team, but idiot has two.