Arkiv

Arkiv för november, 2011

SQL syntax for deleting

november 17th, 2011 Inga kommentarer

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 Taggar: