JusticeVan Posted December 22, 2009 Share Posted December 22, 2009 I'm rather new to SQL and trying to use bcp output to csv file.I'm using the following which I found to do this.@SQL varchar(8000)select @sql = 'bcp "Select * FROM table" queryoutc:\bcp\test.txt -c -t, -T -S '+ @@servernameexec master..xp_cmdshell @sqlSeems to run fine, no errors, but there is no output file created even though there is data in the table.Instead I get:usage: bcp {dbtable | query} {in | out | queryout | format} datafile [-m maxerrors] [-f formatfile] [-e errfile] [-F firstrow] [-L lastrow] [-b batchsize] [-n native type] [-c character type] [-w wide character type] [-N keep non-text native] [-V file format version] [-q quoted identifier] [-C code page specifier] [-t field terminator] [-r row terminator] [-i inputfile] [-o outfile] [-a packetsize] [-S server name] [-U username] [-P password] [-T trusted connection] [-v version] [-R regional enable] [-k keep null values] [-E keep identity values] [-h "load hints"] [-x generate xml format file]NULLCould any here let me know what I'm missing?Thanks much. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 22, 2009 Share Posted December 22, 2009 If it's printing the usage instructions it sounds like you're not using bcp correctly. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.