DECLARE @tablas TABLE(tableName nvarchar(100))
INSERT INTO @tablas
SELECT t.TABLE_SCHEMA+ '.'+t.TABLE_NAME FROM INFORMATION_SCHEMA.TABLES T
DECLARE @loopCounter INT
SELECT @loopCounter = 0
SELECT @loopCounter = COUNT(*) FROM INFORMATION_SCHEMA.TABLES
WHILE @loopCounter>0
BEGIN
SELECT TOP 1 @tableName = tableName FROM @tablas
DECLARE @sql NVARCHAR(500) = ''
SET @sql = @sql +'Truncate table '+ @tableName
EXECUTE (@sql)
SELECT @sql
SET @loopCounter = @loopCounter-1
DELETE TOP (1) @tablas
END
Friday, 9 February 2018
Truncate Database All Table In SqlServer
Subscribe to:
Post Comments (Atom)
Get all non-clustered indexes
DECLARE cIX CURSOR FOR SELECT OBJECT_NAME(SI.Object_ID), SI.Object_ID, SI.Name, SI.Index_ID FROM Sys.Indexes SI ...
-
Create one class named RandomSNKGenerator using System; using System.Collections.Generic; using System.Linq; using System.Web; ...
-
We need to jQuery package from http://jqueryui.com/ and jQuery-UI plugin and jQuery styles. Download the packages http://jqueryui.com/a...
-
DECLARE @MyTable VARCHAR(255) DECLARE myCursor CURSOR FOR SELECT '['+TABLE_SCHEMA+'].['+TABLE_NAME+']' FROM inf...
No comments:
Post a Comment