呵呵,ALTER TABLE可以吗
老大……

解决方案 »

  1.   

    sp_configure 'allow update',1
    reconfigure with override
    update syscolumns set colstat=0 where colstat=1 and id=object_id('tablename')
    sp_configure 'allow update',0
    reconfigure with override
    这是取消自增列的
      

  2.   

    to  lxzm1001(*蓝星之梦*) :  'sp_configure' 附近有语法错误。 这是怎么回事
    我把这一句注释了就出现: 未启用对系统目录的特殊更新。系统管理员必须重新配置 SQL Server 以允许这种操作。 
      

  3.   

    to zjcxc(邹建)  我想在程序里实现往表中批量导入数据,包括自增键的数据 但是自增键是不让写的 我该怎么办啊
      

  4.   

    sp_configure 'allow update',1
    reconfigure with override
    go
    update syscolumns set colstat=0 where colstat=1 and id=object_id('tablename')
    go
    sp_configure 'allow update',0
    reconfigure with override要不就加go,要不你就分开执行
      

  5.   

    如何用sql语句去掉列的自增长(identity)**无法通过alter把现有自增字段改为非自增
    比如alter table a alter id int,自增属性不会去掉
    通过修改系统表可以做到(此法可能有不可预知的结果,慎之...)
    sp_configure 'allow updates', 1
    GO
    reconfigure with override
    GO
    update syscolumns set colstat = colstat & 0x0000 
    where  id=object_id('表名') and name='字段名'
    GO
    sp_configure 'allow updates', 0---------------------------------------------
    --折中的办法
    alter table a add xxx int
    update a set xxx=id
    alter table a drop column id
    exec sp_rename 'xxx', 'id', 'column'
    ---------------------------------------------