team2005
asked on
Howto Export from ms-sql database to a csv-file
Hi!
How do i make a query, that selects alot of fields, and export the data
to a csv-file ?
How do i make a query, that selects alot of fields, and export the data
to a csv-file ?
the sql command will be like:
sqlcmd -S myServer -d myDB -E -o "MyData.csv" -Q "select column1, column2 from dataTable" -W -w 999 -s","
-W remove trailing spaces from each individual field
-s"," sets the column seperator to the comma (,)
-w 999 sets the row width to 999 chars
ASKER
Hi!
Must use stored procedure for this..
How do i do this ?
Must use stored procedure for this..
How do i do this ?
Go to following link
http://searchsqlserver.techtarget.com/tip/Stored-procedure-Simplify-comma-separated-value-CSV-exports
it requires free membership signup to view the Stored Procedure.
HTH
Ashok
http://searchsqlserver.techtarget.com/tip/Stored-procedure-Simplify-comma-separated-value-CSV-exports
it requires free membership signup to view the Stored Procedure.
HTH
Ashok
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
you can just issue select with fields desired and execute the select
then
right-click on the data grid, select all, Save As
csv-file
HTH
Ashok