create table tb(id int,name varchar(10),course int)
insert into tb select 2,'n2',10
insert into tb select 4,'n4',20
insert into tb select 3,'n3',30
insert into tb select 1,'n1',40
insert into tb select 6,'n6',50
insert into tb select 5,'n5',60
select * into c from 
(
select name,course from tb order by id 
) adrop table tb
drop table c
这里我想把排完序的结果插入c表去 为什么老说order by 的地方有错误呢。去掉就对了。。

解决方案 »

  1.   

    --笨办法
    select * into c from 
    (
    select top 100 name,course from tb order by id 
    ) a
      

  2.   

    select * into c from 
    (
    select name,course from tb
    ) a  order by id 
      

  3.   

    你搞复杂了-_-select * into c
    from tb
    order by id就可以了
      

  4.   

    Orselect * into c from 
    (
    select TOP 100 Percent name,course from tb order by id 
    ) a
      

  5.   

    select name,course into c from tb order by id 
      

  6.   

    create table tb(id int,name varchar(10),course int)
    insert into tb select 2,'n2',10
    insert into tb select 4,'n4',20
    insert into tb select 3,'n3',30
    insert into tb select 1,'n1',40
    insert into tb select 6,'n6',50
    insert into tb select 5,'n5',60select name,course into c from tb order by id  drop table tb
    drop table c--这样不行吗?
      

  7.   

    没有top语句存在的话,子查询不允许带order