bcp utility  
Author Message
jpreman





PostPosted: Sat Jul 10 15:26:10 CDT 2004 Top

SQL Server Developer >> bcp utility

Hello,
I am panning to use bcp to import csv file into SQL table.
I have following questions:
1. can I specify append or overwrite?
2. I have an identity filed in the SQL table and this is
not available in the file, I need to update all the
columns other than identity, can I get bcp do that?
Thanks,
Jim.

SQL Server302  
 
 
Steve





PostPosted: Sat Jul 10 15:26:10 CDT 2004 Top

SQL Server Developer >> bcp utility Tables are a little like grocery bags, and bcp will INSERT data into
them. Have you ever tried to "overwrite" existing groceries in a
shopping bag? You can put them in the bag or not, that's all - so bcp
does what you might think of as append, not overwrite. If you want the
new groceries to replace the old ones, you have to remove the old ones
first, using DELETE (take them out carefully) or TRUNCATE TABLE (just
dump them all out). While tables also support UPDATE operations, bcp
doesn't - it copies data to the table.

If your table has an identity column and your data file doesn't, you
need to use a format file. One is always needed when the columns of the
data file don't match up with the columns of the table. Check out the
-E argument in the "Arguments" click-to-open section of the topic "bcp
Utility" in SQL Server Books Online.

-- Steve Kass
-- Drew University
-- Ref: A4DEDE79-5E64-44A4-8865-001E6D9B303A



>Hello,
>I am panning to use bcp to import csv file into SQL table.
>I have following questions:
>1. can I specify append or overwrite?
>2. I have an identity filed in the SQL table and this is
>not available in the file, I need to update all the
>columns other than identity, can I get bcp do that?
>Thanks,
>Jim.
>
>
>