May 27, 2009 - Geeky General Comments Off on SQL syntax to delete records in a table
SQL syntax to delete records in a table
I had a need to delete all records in a certain table which matched some specific criteria, in this case, a PortalID. There were over 300 records, so using the GUI SQL Manager wasn’t going to cut it.
Here’s the code I used:
(Be sure to change the DatabaseName to match your own.
Table name: Modules, Field name: PortalID
DELETE FROM [DB_DATABASENAME].[dbo].[Modules] WHERE [PortalID] = 5[/code:4nd9nyef]