alter table alumn drop CONSTRAINT 'fk_kcspmxz_spml_spdm'

解决方案 »

  1.   

    declare @a varchar(20)
    select @a=c.name from syscolumns a,sysconstraints b,sysobjects c where a.id=object_id('表名') and a.name='主鍵列名' and a.id=b.id and b.constid=c.id and c.name like 'PK%'
    exec('alter table 表名 drop constraint '+@a)
      

  2.   

    为什么我在执行以下语句:
    if exists (select * from sysobjects where id = object_id('dbo.fk_kcspmxz_spml_spdm ) and sysstat & 0xff = 11)
    ALTER table jhdnr DROP CONSTRAINT fk_jhdnr_spml_spdm
    go
    ALTER table jhdnr ADD CONSTRAINT fk_kcspmxz_spml_spdm FOREIGN KEY 
    ( spdm ) REFERENCES dbo.spml ( spdm )
    GO
    运行了分钟还是没有任何提示还在运行:表中有几十条记录
      

  3.   

    在企业管理器中,设计spml表,选择关系,找到这个关系删除