怎么根据datetime类型查看当天数据,然后把查询结果插入另一张表?

风中云 2012-02-13 10:26:29
如题:用sql怎么查询table1中的当天数据然后插入的table2中?
...全文
80 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
黄_瓜 2012-02-13
  • 打赏
  • 举报
回复
insert into table2  select * from table1
where dd>convert(varchar(10),getdate(),120)
and dd<dateadd(dd,1,convert(varchar(10),getdate(),120))
AcHerat 2012-02-13
  • 打赏
  • 举报
回复
insert into table2(...)
select ...
from table1
where datediff(dd,datetime,getdate()) = 0

22,210

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧