Groups | Blog | Home
all groups > sql server clients > may 2005 >

sql server clients : Constraints


Hari Prasad
5/26/2005 12:00:00 AM
Hi Joh,

Why do you want create Foreign key constrain for all the columns in a table
:), Probably i understood your question wrongly.

What you could do is all the constrains specificatins can be view in the
below information schema view. Have a look into it and analyze ur
requirement.

INFORMATION_SCHEMA.TABLE_CONSTRAINTS

Thanks
Hari
SQL Server MVP

[quoted text, click to view]

Joh
5/26/2005 12:00:00 AM
No you took my question wrongly.... I want to make sure Primary Key &
Foreign Key constraints are there in my database... nothing would be missed
for instance....

Emp Dept
EmpID DeptID
DeptID DeptName
EmpName

According to the above situation I have to make sure in the emp table there
should be a foreign key constraint on DeptID column.. Is there any query
through which I can make sure about it.... hope now you understand my
question.

Thanks

[quoted text, click to view]

Hari Prasad
5/26/2005 12:00:00 AM
Hi,

I dont have a query for this with me. I personally recommend you to use MS
Visio / Erwin to do the logical / physical data model with all relationship.
But for validating you could use INFORMATION_SCHEMA.TABLE_CONSTRAINTS system
view.

Thanks
Hari
SQL Server MVP

can you please work with the system view
INFORMATION_SCHEMA.TABLE_CONSTRAINTS? This will help
[quoted text, click to view]

Joh
5/26/2005 10:00:20 AM
Can any one tell me regarding the foreign key constraints like I wanna
findout which columns doesn't contain the foreign key constraint so that I
can create it....


Thanks in advance.

AddThis Social Bookmark Button