|
以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,
null,
a.流水号,
a.日期,
a.路线名称,
a.车牌号码,
a.司机流水号,
a.乘务员流水号,
a.出发时间,
a.到达时间,
a.创建者,
a.创建时间,
a.修改者,
a.修改时间,
null,
null,
null,
null,
null
from
vms.dbo.昨日行驶记录_v a
union
select 3,
2,
null,
a.流水号,
a.日期,
a.路线名称,
a.车牌号码,
a.司机流水号,
a.乘务员流水号,
a.出发时间,
a.到达时间,
a.创建者,
a.创建时间,
a.修改者,
a.修改时间,
b.流水号,
b.出发站点,
b.到达站点,
b.价格,
b.票数
from
vms.dbo.昨日行驶记录_v a left join vms.dbo.售票记录 b on a.流水号=b.行驶记录流水号
order by [steerrecover!2!number],[ticket!3!ticketnumber]
for xml explicit
求助于各位大大们了!!!
|
|