怎么根据datetime类型查看当天数据,然后把查询结果插入另一张表?
如题:用sql怎么查询table1中的当天数据然后插入的table2中?
------解决方案--------------------insert into table2(...)
select ...
from table1
where datediff(dd,datetime,getdate()) = 0
------解决方案--------------------SQL code
insert into table2 select * from table1
where dd>convert(varchar(10),getdate(),120)
and dd<dateadd(dd,1,convert(varchar(10),getdate(),120))