|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Bulk insert from text file in to multiple tableHi,
I have a requirement, i need to bulk insert the data form the text file. we need to insert firt 2 values from text file and insert into first table. then retrive the primary key value of inserted values then with this value as Forign key insert next 4 value from the text file. is there any way we can do it in bulk insert. thanks, prabhudeva.K *** Sent via Developersdex http://www.developersdex.com *** > then retrive the primary key value of inserted values then with this No, you can't retrieve data with a bulk insert technique. This is one of > value as Forign key insert next 4 value from the text file. > is there any way we can do it in bulk insert. the downsides in using IDENTITY as a surrogate key. If you must have a surrogate key rather than a natural one, you could use uniqueidentifier instead and assign the GUID value in application code before the bulk insert. That way, you'll know the PK value for the related inserts. The downside is that the storage size is larger and the assigned values will be basically random, which can reduce insert performance with large tables. You can address the random issue by using UuidCreateSequential instead of UuidCreate in app code. -- Show quoteHope this helps. Dan Guzman SQL Server MVP "Prabhudeva Kenganavara" <rekhaprabhud***@gmail.com> wrote in message news:uhM6rYflGHA.2180@TK2MSFTNGP05.phx.gbl... > Hi, > I have a requirement, i need to bulk insert the data form the text file. > > we need to insert firt 2 values from text file and insert into first > table. > > then retrive the primary key value of inserted values then with this > value as Forign key insert next 4 value from the text file. > is there any way we can do it in bulk insert. > thanks, > prabhudeva.K > > *** Sent via Developersdex http://www.developersdex.com *** |
|||||||||||||||||||||||