Posts Tagged ‘SQL

— Disable all the constraints in database EXEC sp_msforeachtable “ALTER TABLE ? NOCHECK CONSTRAINT all” EXEC sp_msforeachtable “delete from ? ” — Enable all the constraints in database EXEC sp_msforeachtable “ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all”

When writing SQL queries, especially the sp (stored procedure), temp table (temporary table) can create difficulties arise. At least you need to create delete the temporary table. The way to overcome this difficulty, such as the following to create a temporary table to use. DECLARE @TMP_TABLE_NAME( FIELD_ID INT IDENTITY(1, 1), FIELD_1 INT, FIELD_2 INT, FIELD_3 […]

SQL sorguları yazarken, özellikle sp (stored procedure), temp table (geçici tablo) oluştururken sıkıntılar çıkabiliyor. En azından oluşturduğunuz geçici tabloyu silmeniz gerekiyor. Bu sıkıntıları aşmanın yolu geçici tabloyu aşağıdaki gibi oluşturup kullanmaktır. DECLARE @TMP_TABLE_NAME( FIELD_ID INT IDENTITY(1, 1), FIELD_1 INT, FIELD_2 INT, FIELD_3 NVARCHAR(MAX) )


top