select 名次,编号,姓名,职业,总分 into #temp where 职业='"& Str &"' 
alter table #temp add  newfield int identity(1,1)
select * from #temp

解决方案 »

  1.   

    多谢了,问题已经解决,为方便大家我把我的代码贴出来:
            txtSQL = "select 编号,姓名,职业,总分 into a from score where 职业='计算机'"
            Set mrc = Execute(txtSQL, MsgText)
            
            txtSQL = " alter table a add  名次 int identity(1,1)"
            Set mrc = Execute(txtSQL, MsgText)
            
            Adodc1.ConnectionString = ConnectString
            Adodc1.RecordSource = "select 名次,编号,姓名,职业,总分 from a"
            Adodc1.Refresh
            
            txtSQL = "drop table a"
            Set mrc = Execute(txtSQL, MsgText)