SQL SERVER : All By The Script (2) - Export Data to CSV Files
To export data to a comma separated file (csv), use the bcp command line utility:bcp [<database-name.>][<owner.>]<table-name> in <csv-file> [/U<username>] [/P<password>] [/S<server-name>] /c /t
<database_name>
It can only be omitted if the desired database is the default database.
is used.
<password>
<server_name>
if the database is on the local machine (i.e. the same machine. as the bcp
command is issued from).
Note : (Important !!)
The flags are case sensitive.
Below are step to running this Script :
1. Clik Start
2. Click Run
3. On the Open Text box and then write : "cmd"
4. Now Command prompt will displayed
5. Write the syntax
Sample Syntax :
bcp northwind.dbo.products out products.csv /U /P /komnet /c /t
6. After the command was running, check this file ( products.csv ) on current folder.
0 Comments:
Post a Comment
<< Home