Sqlserver
 sql >> Teknologi Basis Data >  >> RDS >> Sqlserver

Matikan kendala sementara (MS SQL)

-- Disable the constraints on a table called tableName:
ALTER TABLE tableName NOCHECK CONSTRAINT ALL

-- Re-enable the constraints on a table called tableName:
ALTER TABLE tableName WITH CHECK CHECK CONSTRAINT ALL
---------------------------------------------------------

-- Disable constraints for all tables in the database:
EXEC sp_msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'

-- Re-enable constraints for all tables in the database:
EXEC sp_msforeachtable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL'
---------------------------------------------------------


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Konfigurasikan Lingkungan StartUp di SQL Server Management Studio (SSMS) - Tutorial SQL Server / TSQL Bagian 7

  2. SQRT() Contoh di SQL Server

  3. Memantau Penghitung Kinerja melalui PERFMON | Pemecahan Masalah Kinerja SQL Server -3

  4. Panduan untuk CTE di SQL Server

  5. Cara Memperbaiki:JSON_VALUE Mengembalikan NULL dengan Long String (SQL Server)