请高手帮看看这个程序
set nocount on
select
s1.fbillno as 订单编号,
s2.fentryid as 订单行号,
t.FName as 物料名称,
t.FModel as 规格型号,
s2.FQty as 订单数量,
i2.FQty as 出库数量,
s2.FDate as 出货日期,
i1.fdate as 实际出货日期,
datediff("D",'s2.FDate','i1.fdate') as 相差天数/*主要问题出在这里,想要显示2个日期相减的值*/
from SEOrderEntry s2
join SEOrder s1 on s1.FInterID=s2.FInterID
join t_ICItem t on s2.FItemID=t.fitemid
join ICStockBillEntry i2 on s2.FInterID=i2.FSourceInterId and s2.FEntryID=i2.FSourceEntryID
join ICStockBill i1 on i1.FInterID=i2.FInterID
where
(s1.FDate>='2013-10-1'and s1.FDate<='2013-10-31')and
(t.FNumber>='07.01.01.001'and t.FNumber<='07.02.99.99.999')and
i1.ftrantype='21'
order by 物料名称
--------------------------------------------------------------------------
执行以后有错误提示:
消息 241,级别 16,状态 1,第 2 行
从字符串转换日期和/或时间时,转换失败。
不知道是哪错了,请大家帮看看。万分感谢。
------解决方案--------------------datediff(d,s2.FDate,i1.fdate)