SQL Server 데이터베이스의 고아 제약 조건
-
15-11-2019 - |
문제
다음 쿼리를 실행하면 클라이언트 데이터베이스의 모든 제약 조건이 발생합니다.그러나 결과 집합의 여러 행은 부모가없는 것으로 보이지 않습니다. I.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.e.e.e.e.
SELECT name, type_desc, OBJECT_NAME(parent_object_id), parent_object_id
FROM sys.objects
WHERE is_ms_shipped = 0
AND type_desc LIKE '%_CONSTRAINT'
.
데이터베이스에 고아 제약 조건이 있음을 의미합니까?그렇다면 어떻게 제거합니까?
해당 이름에서는 많은 양의 구조가 변경되기 전에 남은 음식을 볼 수 있습니다.
해결책
Using sp_helptext
I can see they were created using a CREATE DEFAULT
statement, e.g.:
CREATE DEFAULT dbo.MyDefault AS 2
This means they are simply unbound defaults, which can be bound using the sp_binddefault
according to MSDN, and removed with a simple DROP DEFAULT
statement:
DROP DEFAULT dbo.MyDefault
I wasn't aware of this syntax, which apparently will be removed in a future version of SQL Server, according to the aforementioned MSDN article.
제휴하지 않습니다 StackOverflow