
sql server - Truncate with where clause - Database Administrators …
Apr 12, 2017 · Can I use truncate command with a where clause? I need to remove specific rows from several tables. How can I delete specific data from the entire database? SELECT …
sql server - DELETE vs TRUNCATE - Database Administrators Stack …
Dec 13, 2012 · Truncate requires "alter table" permission (in the sense that truncate is plug in replacement for delete).
sql server - How do I identify the column (s) responsible for "String ...
58 I am generating some queries automagically with code I wrote to SELECT from a remote Pg database, and insert into a local SQL Server database. However, one of them is generating …
sql server - Truncate tables with dependent foreign key constraints ...
8 You cannot truncate a table that has foreign key constraints. I would script your truncate statement to drop the constraints, then truncate the table, and then re-create the constraints. …
t sql - Rolling back truncate table - Database Administrators Stack ...
Nov 26, 2019 · I have a stored procedure that does the following: BEGIN TRANSACTION -- Code to delete updated records from production (dbo) table DELETE FROM [dbo].[factMyTable] …
Truncating a table with a foreign key constraint - SQL Server
Sep 29, 2018 · Doesn’t matter if the table is empty. You need to either drop and re-create the foreign key constraint or just perform a delete instead of a truncate. How often are you really …
sql server - Why use both TRUNCATE and DROP? - Database …
No. TRUNCATE and DROP are almost identical in behavior and speed, so doing a TRUNCATE right before a DROP is simply unnecessary. Note: I wrote this answer from a SQL Server …
How do I truncate the transaction log in a SQL Server 2008 …
9 How do I truncate the transaction log in a SQL Server 2008 database? What are possible best ways? I tried this from a blog as follows: 1) From the setting database to simple recovery, …
sql server - What permissions are necessary for truncating a table ...
As per : The minimum permission required is ALTER on table_name. TRUNCATE TABLE permissions default to the table owner, members of the sysadmin fixed server role, and the …
How to shrink log file for Azure SQL Database?
Oct 17, 2024 · Azure SQL Database automatically shrinks transaction log file to avoid excessive space usage that can lead to out-of-space errors. It is usually not necessary to shrink the …