August 30, 2010 at 10:59 am
Hi,
I am trying to remove all the unwanted tables ,sps,views in MYDB.The names we kept for our tables and sps will not be in number so i tried to get them separately,so i tried but i couldnt in single query ,the below is my requirement
Select * from sys.sysobjects where Xtype='u' and name not like ('%1%','%2%','%3%')
Select * from sys.sysobjects where Xtype='p' and name not like ('%1%','%2%','%3%')
Select * from sys.sysobjects where Xtype='V' and name not like ('%1%','%2%','%3%')
Thanks
Parthi
Thanks
Parthi
August 30, 2010 at 11:17 am
don't forget the LIKE operator can take some quasi regular expression commands to help determint ehte list:
--every proc/view/table that DOES NOT contain a number.
select * from sys.objects where name like '%[^0-9]%' and type in('U','V','P')
--every proc/view/table that DOES contain a number.
select * from sys.objects where name like '%[0-9]%' and type in('U','V','P')
--every proc whihc contains a X y or z in the name
select * from sys.objects where name like '%[x-z,X-Z]%' and type in('U','V','P')
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply