SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to find the list of all check constraints??
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mohan123
Constraint Violating Yak Guru

India
252 Posts

Posted - 03/19/2013 :  03:08:39  Show Profile  Reply with Quote
hello all,

i have a database in which i need to find out all Check constraints list and NoCheck constraints list for all the tables and lot of tables in my database are given realtion to tables WITH NOCHECK constraint. i need to make it them as CHECK CONSTRAINT at one go.....please suggest me

P.V.P.MOhan

mohan123
Constraint Violating Yak Guru

India
252 Posts

Posted - 03/19/2013 :  03:31:20  Show Profile  Reply with Quote
hello all,

in table to table relationships we create foreign key relationship like example :

ALTER TABLE [dbo].[User] WITH NOCHECK ADD CONSTRAINT [FK_User_Department] FOREIGN KEY([DepartmentID])
REFERENCES [dbo].[Department] ([DepartmentID])
GO
[/Code]
so now i need to make them as

WITH CHECK ADD CONSTRAINT

is there any sugestion to make all the tables at one go

P.V.P.MOhan
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 03/19/2013 :  03:32:50  Show Profile  Reply with Quote
Check the link to get list of WITH CHECK constraints and WITH NOCHECK lists
http://geekswithblogs.net/dturner/archive/2011/01/31/sql-constraints-check-and-nocheck.aspx

--
Chandu
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2223 Posts

Posted - 03/19/2013 :  03:40:10  Show Profile  Reply with Quote
Get list of WITH NOCHECK CONSTRAINT Table names so that you can alter tables by using following options

WITH CHECK CHECK CONSTRAINT ALL

--
Chandu

Edited by - bandi on 03/19/2013 03:40:52
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000