How can you determine which method created the constraint in SQL Server 2008?

There are two ways to create a constraint,

Method A:

ALTER TABLE dbo.<tablename> ADD CONSTRAINT
<namingconventionconstraint> UNIQUE NONCLUSTERED
(
<columnname>

Method B:

CREATE UNIQUE NONCLUSTERED INDEX
<namingconventionconstraint> ON dbo.<tablename>
(
<columnname>
) ON [PRIMARY]

However, it seems that these restrictions need to be discarded using a method that depends on how they were created (drop restriction compared to the drop index). Is there a way to determine which method was created to limit, in addition to trying the method and checking if it worked? I know that you may have SQL Server to create a drop script for you, but I'm looking for some kind of query.

+3
source share
1 answer

, /

+8

Source: https://habr.com/ru/post/1757006/


All Articles