select getdate(),b.orglookupcode,a.固定资产代码,2,
case
when DATEDIFF(year, convert(char(10),cast(领用日期 as datetime),102),
getdate())<折旧年限 then convert(money,金额)/(折旧年限*12)
else 0 end as money
from OPENROWSET('MICROSOFT.JET.OLEDB.4.0',
'Excel 5.0;HDR=YES;IMEX=1;DATABASE=D:\Excel\固定资产设备.xls',设备固定资产$)
a,
hcostdata..t_org b
where a.使用科室=b.orgname
服务器: 消息 7341,级别 16,状态 2,行 1
未能得到列 '[a].领用日期' 的当前行的值(从 OLE DB 提供程序
create table test
(日期 datetime)
insert test
select '2006.9.8' union all
select '2006.9.9' union all
select '2006.9.10'
select convert(varchar(10),cast(日期 as datetime),102) from test
drop table test
----------------------------------
----------
2006.09.08
2006.09.09
2006.09.10
to zsforever(虎虎) :
是一个字段都要这样处理 把
select convert(varchar(10),cast('2006.9.18' as datetime),102)
换成select convert(varchar(10),cast(日期 as datetime),102)
不行,请问怎么办?