Archive

Archive for November, 2011

SQL syntax for deleting

November 17th, 2011 No 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: