SQL bcp Exprot to CSV:
Following process can be used to create csv from sql server with bcp command.
First of all we need a format file and then bcp command in stored proc or
run directly from query analyzer.

Sample Format File

7.0 [sql bcp version]
305 [number of data fields]
1 SQLCHAR 0 9 "," 1 MyField


Exec master..xp_cmdshell bcp "SELECT * FROM ##WrkData_LBW_Exp_2" queryout ' + [export file].csv + ' -f\\[format file].fmt -U [user name] -P [pasword]

reference: bcp

Comments

Popular posts from this blog

SQL 2008

SQL Buddy

Microsoft a BI Force