在DTS(SQL Server的导入/导出向导)导入Excel数据时,如何在生成的表中加入“DTS导入时间”字段,我使用getdate(),但是出现"表达式中getdate未定义",请问正确的方式如何实现,非常谢谢!
SQL语句如下:
select 'MSC24', MSC24$
.A号码
, MSC24$
.B号码
, MSC24$
.Call Start Time
, MSC24$
.A LAC
, MSC24$
.A Cell
, '0',getdate()
from MSC24$
where MSC24$
.A号码
<>'' and MSC24$
.A号码
<> Null
order by MSC24$
.A号码
, MSC24$
.B号码
, MSC24$
.Call Start Time
, MSC24$
.A LAC
, MSC24$
.A Cell
---------------------------------------------------------------
既然是从Excel导数据,那你应该使用date或者now函数,getdae()是sql server支持的函数,excel不支持.
date只返回日期,now函数返回日期及时间.(例如,使用now()函数应该如下,全角字符的问题自己检查一下,我就不检查了)
select 'MSC24', MSC24$
.A号码
, MSC24$
.B号码
, MSC24$
.Call Start Time
, MSC24$
.A LAC
, MSC24$
.A Cell
, '0',now()
from MSC24$
where MSC24$
.A号码
<>'' and MSC24$
.A号码
<> Null
order by MSC24$
.A号码
, MSC24$
.B号码
, MSC24$
.Call Start Time
, MSC24$
.A LAC
, MSC24$
.A Cell