How do I check if a constraint is disabled or enabled?
Constraints have been enabled and disabled by
ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
but I like to see the status of the constraints.check the sysconstraints table :)|||You can use the OBJECTPROPERTY() function for that.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mikael Be" <MikaelBe@.discussions.microsoft.com> wrote in message
news:7FB01968-C939-41FE-B327-EA5D9E6C6385@.microsoft.com...
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.|||Sure check out OBJECTPROPERTY in BOL, specifically the CnstIsDisabled
property name.
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.|||Thank you guys, the OBJECTPROPERTY helped me.
I only needed this simple information.
select Constr = fk.name,Status = CASE OBJECTPROPERTY ( object_id(fk.name),'CnstIsDisabled')
WHEN 1 THEN 'Disabled'
ELSE 'Enabled'
END
from (select name from sysobjects
where xtype = 'F') as fk
order by name
/Mikael Be
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
Showing posts with label disabled. Show all posts
Showing posts with label disabled. Show all posts
Wednesday, March 21, 2012
How check if constraint is enabled/disabled?
How do I check if a constraint is disabled or enabled?
Constraints have been enabled and disabled by
ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
but I like to see the status of the constraints.check the sysconstraints table
|||You can use the OBJECTPROPERTY() function for that.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mikael Be" <MikaelBe@.discussions.microsoft.com> wrote in message
news:7FB01968-C939-41FE-B327-EA5D9E6C6385@.microsoft.com...
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.|||Sure check out OBJECTPROPERTY in BOL, specifically the CnstIsDisabled
property name.
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.|||Thank you guys, the OBJECTPROPERTY helped me.
I only needed this simple information.
select Constr = fk.name,Status =
CASE OBJECTPROPERTY ( object_id(fk.name),'CnstIsDisabled')
WHEN 1 THEN 'Disabled'
ELSE 'Enabled'
END
from (select name from sysobjects
where xtype = 'F') as fk
order by name
/Mikael Be
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
Constraints have been enabled and disabled by
ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
but I like to see the status of the constraints.check the sysconstraints table
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mikael Be" <MikaelBe@.discussions.microsoft.com> wrote in message
news:7FB01968-C939-41FE-B327-EA5D9E6C6385@.microsoft.com...
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.|||Sure check out OBJECTPROPERTY in BOL, specifically the CnstIsDisabled
property name.
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.|||Thank you guys, the OBJECTPROPERTY helped me.
I only needed this simple information.
select Constr = fk.name,Status =
CASE OBJECTPROPERTY ( object_id(fk.name),'CnstIsDisabled')
WHEN 1 THEN 'Disabled'
ELSE 'Enabled'
END
from (select name from sysobjects
where xtype = 'F') as fk
order by name
/Mikael Be
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
Labels:
allbut,
byalter,
constraint,
constraints,
database,
disabled,
enabled,
enabledconstraints,
microsoft,
mysql,
nocheck,
oracle,
server,
sql,
table
How check if constraint is enabled/disabled?
How do I check if a constraint is disabled or enabled?
Constraints have been enabled and disabled by
ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
but I like to see the status of the constraints.
check the sysconstraints table
|||You can use the OBJECTPROPERTY() function for that.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mikael Be" <MikaelBe@.discussions.microsoft.com> wrote in message
news:7FB01968-C939-41FE-B327-EA5D9E6C6385@.microsoft.com...
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
|||Sure check out OBJECTPROPERTY in BOL, specifically the CnstIsDisabled
property name.
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
|||Thank you guys, the OBJECTPROPERTY helped me.
I only needed this simple information.
select Constr = fk.name,Status =
CASE OBJECTPROPERTY ( object_id(fk.name),'CnstIsDisabled')
WHEN 1 THEN 'Disabled'
ELSE 'Enabled'
END
from (select name from sysobjects
where xtype = 'F') as fk
order by name
/Mikael Be
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
Constraints have been enabled and disabled by
ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
but I like to see the status of the constraints.
check the sysconstraints table
|||You can use the OBJECTPROPERTY() function for that.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Mikael Be" <MikaelBe@.discussions.microsoft.com> wrote in message
news:7FB01968-C939-41FE-B327-EA5D9E6C6385@.microsoft.com...
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
|||Sure check out OBJECTPROPERTY in BOL, specifically the CnstIsDisabled
property name.
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
|||Thank you guys, the OBJECTPROPERTY helped me.
I only needed this simple information.
select Constr = fk.name,Status =
CASE OBJECTPROPERTY ( object_id(fk.name),'CnstIsDisabled')
WHEN 1 THEN 'Disabled'
ELSE 'Enabled'
END
from (select name from sysobjects
where xtype = 'F') as fk
order by name
/Mikael Be
"Mikael Be" wrote:
> How do I check if a constraint is disabled or enabled?
> Constraints have been enabled and disabled by
> ALTER TABLE x NOCHECK/CHECK CONSTRAINTS ALL
> but I like to see the status of the constraints.
Labels:
allbut,
byalter,
constraint,
constraints,
database,
disabled,
enabled,
enabledconstraints,
microsoft,
mysql,
nocheck,
oracle,
server,
sql,
table
Subscribe to:
Posts (Atom)