Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to find the list of all check constraints??

Author  Topic 

mohan123
Constraint Violating Yak Guru

252 Posts

Posted - 2013-03-19 : 03:08:39
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

252 Posts

Posted - 2013-03-19 : 03:31:20
hello all,

in table to table relationships we create foreign key relationship like example :
[code]
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
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-19 : 03:32:50
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
Master Smack Fu Yak Hacker

2242 Posts

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

WITH CHECK CHECK CONSTRAINT ALL

--
Chandu
Go to Top of Page
   

- Advertisement -