43 lines
1.7 KiB
Transact-SQL
43 lines
1.7 KiB
Transact-SQL
/*
|
|
Post-Deployment Script Template
|
|
--------------------------------------------------------------------------------------
|
|
This file contains SQL statements that will be appended to the build script.
|
|
Use SQLCMD syntax to include a file in the post-deployment script.
|
|
Example: :r .\myfile.sql
|
|
Use SQLCMD syntax to reference a variable in the post-deployment script.
|
|
Example: :setvar TableName MyTable
|
|
SELECT * FROM [$(TableName)]
|
|
--------------------------------------------------------------------------------------
|
|
*/
|
|
|
|
USE [$(DatabaseName)]
|
|
GO
|
|
|
|
--------------------------------------------------- DISABLE CONSTRAINS ---------------------------------------------------------------------------
|
|
-- SQL disable all triggers - disable all triggers sql server - t sql disable trigger
|
|
EXEC sp_MSforeachtable @command1="ALTER TABLE ? DISABLE TRIGGER ALL"
|
|
GO
|
|
|
|
-- SQL disable all constraints - disable all constraints sql server
|
|
EXEC sp_MSforeachtable @command1="ALTER TABLE ? NOCHECK CONSTRAINT ALL"
|
|
GO
|
|
|
|
/********** START FILL DATA SCRIPTS **********/
|
|
|
|
:r 01.InitDictionaries.sql
|
|
:r 02.LogicEntities.sql
|
|
:r 03.DemoEntities.sql
|
|
|
|
/********** END FILL DATA SCRIPTS **********/
|
|
|
|
--------------------------------------------------- ENABLE CONSTRAINS ---------------------------------------------------------------------------
|
|
-- SQL enable all triggers - enable all triggers sql server - t sql enable trigger
|
|
EXEC sp_MSforeachtable @command1="ALTER TABLE ? ENABLE TRIGGER ALL"
|
|
GO
|
|
|
|
-- SQL enable all constraints - enable all constraints sql server
|
|
-- sp_MSforeachtable is an undocumented system stored procedure
|
|
EXEC sp_MSforeachtable @command1="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL"
|
|
GO
|
|
|