Exporting data into a text or csv file and Importing the same data into another table from text file with Bulk Copy Processing(BCP)
The below BCP command will export the data(OUT) from table to a text file(.txt) and from the .txt file it will import(IN) the data to another table. Commands are give below. BCP AdventureWorks2014.Person.Person out D:\Test_Person_Peron.txt -S RAMESH\PROD -T -c -b10 -t -S --> ServerName -T --> Windows Authentication -b10 --> The amount of batches -t --> Delimiter values(Eg:',', SPACE, TAB) -c --> If you pass this this will not ask for " Enter the file storage type of field <field_name> [<default>]:" Running BCP command with SQL Query here is the command The below command will BCP out to a CSV(excel file). If you see excel it will capture all column information in single column. However it will appropriately insert the data into destination table. The below BCP command will push the data into required table from .CSV file . Here is the command .