Donnerstag, 9. Oktober 2008

Alle User defined Functions löschen

declare @procName sysname

declare someCursor cursor FOR
SELECT name FROM sysobjects WHERE type in ('FN', 'TF', 'IF') AND objectproperty(id, 'IsMSShipped') = 0

open someCursor
fetch next FROM someCursor INTO @procName
while @@FETCH_STATUS = 0
begin
exec('drop function ' + @procName)
fetch next FROM someCursor INTO @procName
end

close someCursor
deallocate someCursor
go