0

I have a table that has no null value in any column. When I run the following query, query analyzer shows null:

EXECUTE master.dbo.xp_cmdshell 'bcp [RxDB].dbo.[DoctorCompanyRxShare] out D:\DataUpload\DoctorCompanyRxShare.txt - -t"|" -SGXBDDA-S3019\SQLServer2008 -U sa -P tamamyl'

I also tried the following cmd but with same result:

EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT * FROM [RxDB].dbo.[DoctorCompanyRxShare]" queryout D:\DataUpload\DoctorCompanyRxShare.txt - -t"|" -SGXBDDA-S3019\SQLServer2008 -U sa -P tamamyl'

Am I missing something?

Richard
  • 8,961
  • 3
  • 38
  • 47
Mashkur
  • 171
  • 1
  • 4

1 Answers1

0
EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT * FROM [RxDB].dbo.[DoctorCompanyRxShare]"     queryout D:\DataUpload\DoctorCompanyRxShare.txt -t "|" -S "GXBDDA-S3019\SQLServer2008" -U sa -P tamamyl'

There is an unused hyphen between the directory and the -t parameter. Include a space between the -S parameter and the actual server name and wrap the latter into quotes. Do you have an alternative to using | as a separator? There have been other questions on this website from people having issues with using -t "|" (use -t ^ instead, for example).