how to use bcp | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

how to use bcp

Hi
Do I run bcp from command prompt?
Do i have to use change directory to binn for that?
If the directory where the bcp command is in your path setting then you dont need to change directories. If you try to run it from c: and it says command not found but it works from within the mssqlinn then its not in your path setting. You have a choice then to change directories each time or alter your path. BCP from the command prompt is quite easy and very well documented in the BOL. Not knowing what your file type, delimiters etc are, it would probably be easier for you to go there to find the information than for me to include all the possible switches. Chris
I successfully copy table to txt file. But I need to copy table to an other table (same database) Can I do it at all or only by Table->>txt and then fro that txt to an other table?
If you’re copying from the same database, why go through the extra step of making it to a text file first? Yes, you can export to a text file (via a variety of methods) and then import to another table (again by a variety of ways) but if its table-table, in the same database, then its probably faster to keep it there Maybe a bit more background about what you’re trying to accomplish would help.
DTS is another kind of utility available if you need to copy a table to another table or to text file too, which I believe easy to task.
Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Or you could use
SELECT * INTO new_table FROM my_table.
It will create the table and copy the data.
Or if the table already exists
INSERT INTO new_table SELECT * FROM my_table
this is what i did actually :used select into But the vendor of that db suggested to use bcp I never used that before… so I thought there is some benefits from using bcp instead of select into?
In ver.7 BCP used to be a non-logged operation completely and same as select into, in terms of benefits both the methods offers similar kind of approach. The suggestion is : if ain’t broke.. then don’t fix it. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Actually it was broken that because started to fix it. Thank you
In your case DTS is ideal by invoking copy a table to table, as its roundabout approach performing BCP to text file and again bcp to another table. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>