SQL SERVER2000应用BCP导出数据时出现的问题
环境:
系统:WindowsXP SP2
数据库:MS SQL SERVER2000(SP4)
应用:以BCP工具导出执行存储过程中所得的结果
错误信息:
SQLState=37000,NativeError =156
Error =[Microsoft][ODBC SQL Server Driver][SQL Server]在关键字 'where '附近有语法错误。
情况描述:
以上错误只在客户的机子上出现,在我本人的机子已经同事的机子上甚至在我家的机子上都没有出现。
出现错误的BCP语句:bcp "exec vms.dbo.车辆经营_proc " queryout "e:\una\1\driverrecover.xml " -w -T
所用到的视图语句:
CREATE VIEW dbo.昨日行驶记录_v AS
SELECT DISTINCT
日期, 流水号, 路线名称, 车牌号码,司机流水号, 乘务员流水号, 出发时间, 到达时间, 创建者,
创建时间, 修改者, 修改时间
FROM dbo.车辆行驶记录
WHERE (SUBSTRING(CONVERT(char, 日期, 100), 7, 4) = YEAR(DATEADD([day], - 1,
GETDATE()))) AND (SUBSTRING(CONVERT(char, 日期, 100), 1, 2)
= MONTH(DATEADD([day], - 1, GETDATE()))) AND (SUBSTRING(CONVERT(char, 日期,
100), 4, 2) = DAY(DATEADD([day], - 1, GETDATE())))
所用到的存储过程语句:
create proc 车辆经营_proc as select 1 as tag,
null as parent,
null as [root!1!!element],
null as [steerrecover!2!number],
null as [steerrecover!2!date],
null as [steerrecover!2!line],
null as [steerrecover!2!busnumber],
null as [steerrecover!2!drivernumber],
null as [steerrecover!2!stewardnumber],
null as [steerrecover!2!leavetime],
null as [steerrecover!2!arrivetime],
null as [steerrecover!2!creator],
null as [steerrecover!2!createtime],
null as [steerrecover!2!mendir],
null as [steerrecover!2!fixtime],
null as [ticket!3!ticketnumber],
null as [ticket!3!leavestation],
null as [ticket!3!arrivestation],
null as [ticket!3!price],
null as [ticket!3!amount]
from
vms.dbo.昨日行驶记录_v a
union
select 2,
1,