About 50 results
Open links in new tab
  1. sql server - Truncate tables with dependent foreign key constraints ...

    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.

  2. sql server 2019 - Long TRUNCATE operations - Database …

    Oct 3, 2022 · On Microsoft SQL Server 2019, there is a lot of long temp tables TRUNCATE operations with time over 5..10 seconds. Easy query like "TRUNCATE TABLE #tt22" can take over 15 seconds.

  3. sql server - Truncate with where clause - Database Administrators Stack ...

    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 …

  4. Reuse of space after TRUNCATE TABLE by other tables

    Sep 19, 2023 · If I do truncate my table, will the growth of other tables re-use that space freed up, and hence save disk space in the long term? Yup, which is one reason why SHRINK ing is silly - it's just …

  5. sql server - DROP -> SELECT INTO V.S. TRUNCATE -> INSERT INTO ...

    Jun 2, 2025 · 1- CREATE temp table if it doesn't already exist --> TRUNCATE temp table from previous data before inserting new data --> INSERT the new data into temp table. 2- DROP temp table if it …

  6. sql server - overwrite table with data from another table - SQL ...

    It isn't a big one, but if you are working with a smaller table you don't need it. Which leads us to the other option. If however the data is in the several hundred thousand range or smaller then use code like …

  7. SQL Server TRUNCATE TABLE permissions - Database Administrators …

    Dec 12, 2017 · Is it possible to configure SQL Server user so that he doesn't have access to DDL statements but has access to run TRUNCATE TABLE commands. I know that behind the scenes it's …

  8. sql server - What permissions are necessary for truncating a table ...

    As per this reference in BOL: 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 …

  9. sql server - SQL Permission to Truncate Table - Database …

    Feb 28, 2018 · How Do I give permission for user to Truncate all tables in database? The minimum permission required is 'ALTER on table_name' per articles below. With this, how do I give permission …

  10. sql server - Why does truncating a temp table at the end of the stored ...

    Oct 17, 2017 · 12 Truncating a temp table at the end of the stored procedure that creates it seems to cause the space the table uses in tempdb for the data to be released faster than if no truncate …