简体   繁体   English

选择null作为testdate进入#temp_table

[英]select null as testdate into #temp_table

Is there a way to insert/update a datetime value ( getdate() ) into a temp table created like the following: 有没有办法将日期时间值( getdate() )插入/更新到如下所示的临时表中:

select id, null as testdate
into #temp_table

and then later statement: 然后声明:

update #temp_table 
set testdate=getdate()

I get error: 我收到错误:

cannot convert datetime into int... 无法将datetime转换为int ...

Thanks. 谢谢。

Cast the column in the select into 在select into中插入列

select id, cast(null as datetime) as testdate
into #temp_table

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM