Re: Constraints



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
"Joh" <joh@xxxxxxxxxxxx> wrote in message
news:OAQTHygYFHA.3364@xxxxxxxxxxxxxxxxxxxxxxx
> 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
>
> "Hari Prasad" <hari_prasad_k@xxxxxxxxxxx> wrote in message
> news:u8VinYgYFHA.1040@xxxxxxxxxxxxxxxxxxxxxxx
>> 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
>>
>> "Joh" <joh@xxxxxxxxxxxx> wrote in message
>> news:eFoPhsfYFHA.1796@xxxxxxxxxxxxxxxxxxxxxxx
>> > 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.
>> >
>> >
>>
>>
>
>


.



Relevant Pages

  • Re: Trying to optimize a query with a bunch of INNER JOINs
    ... Considering my look-up tables are small, would it improve efficiency at all ... lookup table consisting of only two rows/values, when I join to it, I'm ... > expect your query to perform reasonably well. ... > statistics and creating foreign key constraints if you haven't already ...
    (microsoft.public.sqlserver.programming)
  • Re: How do I print table definitions?
    ... Query the system view INFORMATION_SCHEMA.COLUMNS. ... Move the result into a Excel file and print it. ... Hari ... SQL Server MVP ...
    (microsoft.public.sqlserver.setup)
  • Re: Stored Procedure - Obtaining Output
    ... Create proc testproc ... Hari ... SQL Server MVP ... > How to I trap the output of this query! ...
    (microsoft.public.sqlserver.mseq)
  • Re: FORMAT
    ... Hari ... SQL Server MVP ... I have a query that goes like: ... I know there is a FORMAT function in access, ...
    (microsoft.public.sqlserver.msde)
  • Re: Identity
    ... If you also want to remove data, you can use TRUNCATE table as long as the ... table has no foreign key constraints. ... SQL Server MVP ... > How do you reset or reseed the IDENTITY column? ...
    (microsoft.public.sqlserver.programming)