select * into newtable 
from oldtable
where datediff(month,时间字段,getdate())=2

解决方案 »

  1.   

    select * from tablename where datediff(month,getdate(),时间字段)<2)
      

  2.   

    这样提取的数据是近两个月的数据
    select * from 表
    where datediff(month,时间字段,getdate())<=2
      

  3.   

    where 时间字段 between  dateadd(month,-2,getdate()) and getdate()
      

  4.   

    select * into newtable 
    from oldtable
    where datediff(month,时间字段,getdate())<=2
      

  5.   

    exec master..xp_cmdshell 'bcp "select * from 数据库..表 where 日期>=''2000-01-01'' and 日期<=''2000-03-01''" queryout c:\filename.txt -w -T'
      

  6.   

    sqlserver好象有个软件可以智能备份