使用BCP出现的问題
EXEC master..xp_cmdshell 'bcp "select * from mes76cts4.dbo.sddata where txndate <= '2007-1-11 ' " queryout "c:\b.txt " /S "localhost " /U "sa " /P "sa " -c '
'2007 ' 附近有语法错误。
单单在cmd下是不会出错.主要是用了存储过程.参数调用方式发生冲突了.
如何解决呢?
thanks
------解决方案--------------------EXEC master..xp_cmdshell 'bcp "select * from mes76cts4.dbo.sddata where txndate <= ' '2007-1-11 ' ' " queryout "c:\b.txt " /S "localhost " /U "sa " /P "sa " -c '
看看
------解决方案--------------------试试:
EXEC master..xp_cmdshell 'bcp "select * from mes76cts4.dbo.sddata where txndate <= ' '2007-1-11 ' ' " queryout "c:\b.txt " /S "localhost " /U "sa " /P "sa " -c '
日期前后的单引号要用两个单引号代替