复制强制约束: select OBJECTPROPERTY ( id , 'CnstIsNotRepl' ) from sysobjects where xtype='C' and name='CK_t'
--对复制强制约束没有找到,似乎与 sysconstraints 的status值有关,但不敢确定select 表名=object_name(a.parent_obj), 约束名=a.name, -- 对复制强制约束=c.status & (convert(int, 0x00200000) | convert(int, 0x00020000) | convert(int, 0x00004000)), 对INSERT和UPDATE强制约束=objectproperty(a.id,'CnstIsDisabled') from sysobjects a,syscomments b--,sysconstraints c where a.id=b.id --and a.id=c.constid and objectproperty(a.id,'IsCheckCnst')=1
--笨死了,直接用SQL的存储过程就行了EXEC sp_helpconstraint 要查询的表名
--pbsql(风云) 的那个是对的(奇怪的是我中午一直测试不对,看来是头晕了)select 表名=object_name(a.parent_obj), 约束名=a.name, 对复制强制约束=1-objectproperty(a.id,'CnstIsNotRepl'), 对INSERT和UPDATE强制约束=objectproperty(a.id,'CnstIsDisabled') from sysobjects a,syscomments b--,sysconstraints c where a.id=b.id --and a.id=c.constid and objectproperty(a.id,'IsCheckCnst')=1
谢谢 我用了 select 约束名=a.name, Text=b.text, 对复制强制约束= OBJECTPROPERTY(a.id,'CnstIsNotRepl'), 对INSERT和UPDATE强制约束=objectproperty(a.id,'CnstIsDisabled') from sysobjects a,syscomments b where a.id=b.id and objectproperty(a.id,'IsCheckCnst')=1
然后,我还选择了
1,对复制强制约束
2,对INSERT和UPDATE强制约束我现在想在系统表里找到相关的记录,
我用OBJECTPROPERTY()没有发现想要的东西syscoments 表中没有记录关于复制强制约束,和 INSERT,UPDATE 强制约束的相关信息
select OBJECTPROPERTY ( id , 'CnstIsNotRepl' )
from sysobjects where xtype='C' and name='CK_t'
表名=object_name(a.parent_obj),
约束名=a.name,
-- 对复制强制约束=c.status & (convert(int, 0x00200000) | convert(int, 0x00020000) | convert(int, 0x00004000)),
对INSERT和UPDATE强制约束=objectproperty(a.id,'CnstIsDisabled')
from sysobjects a,syscomments b--,sysconstraints c
where a.id=b.id --and a.id=c.constid
and objectproperty(a.id,'IsCheckCnst')=1
表名=object_name(a.parent_obj),
约束名=a.name,
对复制强制约束=1-objectproperty(a.id,'CnstIsNotRepl'),
对INSERT和UPDATE强制约束=objectproperty(a.id,'CnstIsDisabled')
from sysobjects a,syscomments b--,sysconstraints c
where a.id=b.id --and a.id=c.constid
and objectproperty(a.id,'IsCheckCnst')=1
我用了
select
约束名=a.name,
Text=b.text,
对复制强制约束= OBJECTPROPERTY(a.id,'CnstIsNotRepl'),
对INSERT和UPDATE强制约束=objectproperty(a.id,'CnstIsDisabled')
from sysobjects a,syscomments b
where a.id=b.id
and objectproperty(a.id,'IsCheckCnst')=1