Thursday, October 4, 2012

BCP utility functions in SQL Server.

Bcp in used to copy specific data from a table or multiple table in SQL Server.we can run the Bcp through command utility. Bcp copies the data in specified format.We can copy the Entire table data or we can copy the result sets into  specified file format.

For exporting sqlserver data to text file.


C:\Users\mallireddy>bcp malls.dbo.csvtest out "C:\malls.dat" -T -c -S MALLIREDDY
-PC\MALLIREDDY

malls.dbo.csvtest--->database.schema.table

(C:\malls.dat)out-->output file name & location

-T -->trusted connection.(windows authentication)

-c-->character type

-S--->Server name

Importing text file data into sqlserver:



C:\Users\mallireddy>bcp malls.dbo.csvtest in "C:\malls.dat" -T -c -S MALLIREDDY-
PC\MALLIREDDY







No comments: