Friday, March 9, 2012

How to Find Out Check Columns?

Hi,
I'm working on a database having default constraint names created by SQL
Server 2000. Is it possible to find out which columns the check works on or
even to see the check code?
TIA,
Axel DahmenScript the constraints from the Object Browser in Query Analyzer.
OR:
SELECT * FROM information_schema.check_constraints
David Portas
SQL Server MVP
--|||Try,
use northwind
go
select
object_name(so.parent_obj),
col_name(so.parent_obj, so.info),
sc.text
from
sysobjects as so
inner join
syscomments as sc
on so.[id] = sc.[id]
where
so.xtype = 'C'
and so.parent_obj = object_id('dbo.Products')
go
Microsoft said:
"Querying the system tables directly may not provide accurate information if
system tables are changed in future releases."
AMB
"Axel Dahmen" wrote:

> Hi,
> I'm working on a database having default constraint names created by SQL
> Server 2000. Is it possible to find out which columns the check works on o
r
> even to see the check code?
> TIA,
> Axel Dahmen
>
>|||Great! Thanks a lot!
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> schrieb im
Newsbeitrag news:1108664961.589752.136520@.l41g2000cwc.googlegroups.com...
> Script the constraints from the Object Browser in Query Analyzer.
> OR:
> SELECT * FROM information_schema.check_constraints
> --
> David Portas
> SQL Server MVP
> --
>

No comments:

Post a Comment