2016年7月19日 星期二

SQL SERVER – Disable All the Foreign Key Constraint in Database – Enable All the Foreign Key Constraint in Database

-- Disable all the constraint in databaseEXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
-- Enable all the constraint in databaseEXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"

reference : http://blog.sqlauthority.com/2013/04/29/sql-server-disable-all-the-foreign-key-constraint-in-database-enable-all-the-foreign-key-constraint-in-database/

SQL Server reset auto increment



DBCC CHECKIDENT (mytable, RESEED, 0)
reference : http://stackoverflow.com/questions/510121/reset-autoincrement-in-sql-server-after-delete

Eloquent - use DB and specific db driver


use Illuminate\Database\Capsule\Manager as DB;

$connection = ‘sample’;

$db = DB::connection($connection)

wibiya widget