Answers for "drop all from table sql"

SQL
2

delete all rows from table sql

-- Quick, no possible rollback
TRUNCATE TABLE my_table;
-- With rollback
DELETE FROM my_table;
COMMIT;
Posted by: Guest on January-23-2021
0

drop all data from tables

DELETE FROM my_table;			-- all rows, needs a COMMIT to validate
TUNCATE TABLE my_table;			-- all rows, quicker, no possible roolback
Posted by: Guest on May-08-2021
0

sql drop all tables

DECLARE @sql NVARCHAR(max)=''

SELECT @sql += ' Drop table ' + QUOTENAME(TABLE_SCHEMA) + '.'+ QUOTENAME(TABLE_NAME) + '; '
FROM   INFORMATION_SCHEMA.TABLES
WHERE  TABLE_TYPE = 'BASE TABLE'

Exec Sp_executesql @sql
Posted by: Guest on October-18-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language