hello i am working on this application where i need to import 60k+ user data and insert into different table. i have made a C# application which selects the database and inserts from a text file.like

insert into dbo.dbname ([user_name],[u_id]) values (a,b)

but this apps hangs for 60K+ data so i need to use bulk insert
All this table has two field common namely user_name and u_id so my text input file contains just this two values user_name and u_id(other column values are dynamically inserted like guid,systimestamp..etc which varies for differnt table).

can i have a bulk insert into specific columns ..for example just in user_name and u_id?

the sample of my input text file is given below

abcdedf cd123
hohower ad120
bubble ak324
messi ar016

eagerly waiting to hear from you all
P.S i am using sql server 2005

8 Years
Discussion Span
Last Post by Arpy Giri

can i have a bulk insert into specific columns ..for example just in user_name and u_id?

yes, you need a format file when inserting data in a column's subset. In format file you specify which columns are to insert and which are to overleap.

You may also read there where some aspects of bulk insert had been discussed.

-- tesu

Edited by tesuji: n/a


yeah i came with another technique ...i just created a view of my table with just required attribute column and inserted the data on the view...but it wasnt quite useful.
bulk insert expects a local input file and what i am doing is through a remote client ..
do you think there is any other way to do that and just reading through the links which u gave me ..seems primary key constraints is not maintained.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.