从oldtab中读取字段name,year,条件year字段在1999-2005之间的记录,将其写入newtab,,谢谢

解决方案 »

  1.   

    insert into newtb(name)
    select name from oodtb where year>='1999' and year<='2005'
      

  2.   

    select name, year into newtab from oldtab where year >= 1999 and year <= 2005
      

  3.   

    如果year是datetime类型:
    insert into newtab 
    select name,[year] from oldtab where year([year]) between 1999 and 2005
      

  4.   

    select [name], [year] 
    into newtab 
    from oldtab 
    where [year] between 1999 and 2005
      

  5.   

    insert into newtab (name,year)
    select name,[year] from oldtab where  year >= 1999 and year <= 2005
      

  6.   

    楼楼上
    select name, year into newtab from oldtab where year >= 1999 and year <= 2005
    正解
      

  7.   

    select [name], [year] 
    into newtab 
    from oldtab 
    where [year] between 1999 and 2005
      

  8.   

    insert into newtab 
    select name,year from oldtab where year(year) between 1999 and 2005
      

  9.   


    --假如没有newtab,重新建立一个新表:
    select name,year into newtab from oldtab
    where convert(varchar(4),year,120) between 1999 and 2005--假如存在表结构newtab 
    insert into newtab(name,year) select name,year from oldtab
    where convert(varchar(4),year,120) between 1999 and 2005