数据库用的是SQL2005,现在有张表,大概有2千多万的数据,新增一个字段并设置主键且自增的时候总是提示超时无法创建。
请问大牛们有什么高招,多谢啦。

解决方案 »

  1.   


    如何用SQL语句设置超时时间?请指教
      

  2.   

    create table newtablename(id [int] IDENTITY(1,1) NOT NULL,oldothercolumnlist)
    go
    insert into newtablename(oldothercolumnlist) select * from oldtable
    go
      

  3.   

     呵呵,还有主键!create table newtablename(id [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED ,oldothercolumnlist)
    go
    insert into newtablename(oldothercolumnlist) select * from oldtable
    go
      

  4.   


    drop table oldtable
    go
    sp_rename newtablename,oldtable