About 50 results
Open links in new tab
  1. sql server - Delete rows older than x days without locking table ...

    Feb 4, 2021 · 10 we have a quite big MS SQL database with millions of rows. I created a simple script to delete rows older than 1 month, but this seems to lock the table and creates trouble for the …

  2. Good explanation of cascade (ON DELETE/UPDATE) behavior

    Jun 20, 2013 · 21 SQL:2011 Spec There are five options for ON DELETE and ON UPDATE that can apply to the FOREIGN KEY. These are called <referential actions>, directly from the SQL:2011 spec …

  3. sql server - What is the correct way to check and delete temp table ...

    Jan 31, 2023 · DROP TABLE [#MyTempTbl]; What is the correct way to check and delete temp table? The context is a stored procedure invoked by an agent job. I have tried querying the [tempdb]. [sys]. …

  4. sql server - Permission to grant SELECT, UPDATE, DELETE, ALTER on all ...

    Sep 12, 2022 · In SQL Server 2019, I have created a user defined database role MyDbRole. Now I want to grant following permissions to MyDbRole for all tables in the database. CREATE, SELECT, …

  5. t sql - How does SQL Server process DELETE WHERE EXISTS (SELECT 1 …

    Jan 11, 2021 · The below is a valid TSQL statement. But I want to understand how SQL Server processes it. DELETE A FROM table1 WITH (NOLOCK) WHERE EXISTS ( SELECT 1 FROM table2 …

  6. sql server - How do I force the delete of users from my database ...

    Nov 14, 2019 · I am making a clean backup of our development database for easy fresh spin-ups of the database. This database has about 200 test users that should be deleted to make it truly clean, but …

  7. sql server - What's better for large changes to a table: DELETE and ...

    Nov 17, 2011 · For me it is easier to just delete all the rows and insert new ones, but if this is going to fragment the table and indexes and impact performance then I would prefer to make updates where …

  8. sql server - DELETE vs TRUNCATE - Database Administrators Stack …

    Dec 13, 2012 · DELETE -> the database engine finds and removes the row from the relevant data pages and all index pages where the row is entered. Thus, the more indexes the longer the delete …

  9. sql server - Script to Delete records in multiple table - Database ...

    Apr 18, 2017 · From SQL DELETE Most database management systems allow you to create a foreign key constraint so that if you delete a row in a table, the corresponding rows the related table are also …

  10. SQL Server database size didn't decrease after deleting large number …

    Deleting rows in a database will not decrease the actual database file size. You need to compact the database after row deletion. SQL Server 2005 DBCC SHRINKDATABASE (Transact-SQL) After …