SQL Types In SYSOBJECTS
April 25, 2008 by bnma
The query:
select
distinct type from sysobjects
FN: Scalar Valued Functions
P: Stored Procedures
U: Tables
TF Table Valued Functions
How to delete all of the same type?
use
mydb –replace by your own db name
GO
declare
@procName sysnamedeclare
someCursor cursor FORselect
name from sysobjects where type = ‘P’ AND objectproperty(id, ‘IsMSShipped’) = 0 order by name ascopen
someCursor
fetch
next from someCursor into @procName
while
@@FETCH_STATUS = 0
begin
exec(‘drop proc ‘ + @procName)
fetch next from someCursor into @procName
end
close
someCursor
deallocate
someCursorgo