Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bcp or bulk insert?

Status
Not open for further replies.

jpicks

MIS
Oct 11, 2002
158
0
0
US
I am having trouble doing a bulk insert on a table in sql server 6.5. Is is possible to do a bulk insert or do I have to use bcp?

I'd appreciate it if anyone could give me some example code on how to use bcp to do an insert, or recommend a reference.

Thanks in advance for your help.
 
bcp example - this is used from the dos prompt not through query analyzer this gets the data out

bcp "select * from database..tablename" Queryout name.txt -c -T




bulk insert example -run through query analyzer this gets the data in

bulk insert tablename from 'location'
 
Wilk,

Thanks for the help. I also found another way to bulk insert with bcp.

From the command prompt.

bcp "dbname..tablename" in "c:\\filelocation\inputData.txt" -c -q -S"servername" -U"username" -P"pass"

* -c specifys character input file
* -q specifys that the tablename and filename are in quotes. this takes care of any characters like - or spaces in file names.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top