sql Find potential backup tables

Select 'Drop Table ' + [name]
From dbo.sysobjects
Where  OBJECTPROPERTY(id, N'IsUserTable') = 1
And   (
      [name] Like '%1%'
      Or [name] Like '%2%'
      Or [name] Like '%3%'
      Or [name] Like '%4%'
      Or [name] Like '%5%'
      Or [name] Like '%6%'
      Or [name] Like '%7%'
      Or [name] Like '%8%'
      Or [name] Like '%9%'
      Or [name] Like '%back%'
)
Order By [name] Asc
Query to find potential backup tables, which could be named TableName_20101001. Results in a list of Drop statements - use with caution!

Updated: Saturday 2nd October 2010, 07:06am

There are 0 comments

Leave a comment of your own

Comments are currently closed.