Home > Programmering > SQL syntax for deleting

SQL syntax for deleting

November 17th, 2011 Leave a comment Go to comments

To delete one value:

DELETE FROM [dBName].[dbo].[table_name]
WHERE tag = ‘XXXXxxxxxxxxx01’

To use a *specific* list, you can do this:

DELETE FROM [dBName].[dbo].[table_name]
WHERE tag IN (‘XXXXxxxxxxxxx01’, ‘XXXXxxxxxxxxx05’, ‘XXXXxxxxxxxx11’)

Or, if possible, use a pattern:

DELETE FROM [dBName].[dbo].[table_name]
WHERE tag LIKE ‘XXXXxxxxxxxxx[0-9][0-9]%’

Categories: Programmering Tags:
  1. No comments yet.
  1. No trackbacks yet.