전체 비활성화
DECLARE @sql nvarchar(max) = N'';
;WITH x AS
(
SELECT DISTINCT obj =
QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.'
+ QUOTENAME(OBJECT_NAME(parent_object_id))
FROM sys.foreign_keys
)
SELECT @sql += N'ALTER TABLE ' + obj + N' NOCHECK CONSTRAINT ALL;
' FROM x;
EXEC sys.sp_executesql @sql;
전체 활성화
DECLARE @sql nvarchar(max) = N'';
;WITH x AS
(
SELECT DISTINCT obj =
QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.'
+ QUOTENAME(OBJECT_NAME(parent_object_id))
FROM sys.foreign_keys
)
SELECT @sql += N'ALTER TABLE ' + obj + N' WITH CHECK CHECK CONSTRAINT ALL;
' FROM x;
EXEC sys.sp_executesql @sql;
참고
'개발 > 서버 & DB' 카테고리의 다른 글
CentOs Tomcat + Apache 서버 배포 (0) | 2022.09.19 |
---|---|
[DB2] FK(포렌키) 전체 비활성화 (0) | 2022.09.15 |
맥북 M1 비주얼 스튜디오(VSCode) + Docker 사용 (0) | 2022.09.04 |
무료 도메인 + 무료 SSL 설정 (0) | 2022.08.31 |