About 197,000 results
Open links in new tab
  1. 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]. …

  2. 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 …

  3. 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 …

  4. 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 …

  5. sql server - How do I get back some deleted records? - Database ...

    I mistakenly deleted around 2,000,000 records from a remote SQL Server 2008 table. The server is not granting me access to the backup files on the server side. Is there any way to get back these

  6. 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 …

  7. sql server - Methods of speeding up a huge DELETE FROM <table> …

    Using SQL Server 2005. I am performing a huge DELETE FROM with no where clauses. It's basically equivalent to a TRUNCATE TABLE statement - except I'm not allowed to use TRUNCATE. The …

  8. sql server - How to drop multiple tables with common prefix in one ...

    Sep 29, 2016 · I'm using Microsoft SQL Server 2008.My question is:How to drop multiple tables with common prefix in one query? something like that table names: LG_001_01_STLINE, …

  9. 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 …

  10. sql server - How to improve a delete operation that is running in ...

    Apr 7, 2025 · DELETE FROM #temp WHERE TABLE_ID IN (SELECT TABLE_ID FROM @DeletedIDs) -- DROP TABLE #DeletedIDs SET @RowsDeleted = @@ROWCOUNT; END *TABLE_ID* is the PK …