Click here to Skip to main content
15,886,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have written one query but it is throwing error...

EXEC xp_cmdshell 'bcp "select fs.c_code,emp.c_name from tbl_fs_mst fs
join tbl_emp_mst emp on emp.c_empcode=fs.c_empno
" queryout "D:\pulsedata.xls" -T -c -d "trailpulse"'

error is in below...

please corect this query

VB
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]
  [-d database name]
NULL
Posted
Comments
CHill60 22-Jun-15 9:52am    
Did the first line of output not give an indication of where the bcp syntax was wrong?
TenmanS14 23-Jun-15 9:34am    
not the cause of a BCP error I don't think, but you can't create a .xls file from bcp, you can create a .csv which excel will open though.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900