Translate

Friday, 31 August 2018

drop all user-defined types from sql server database


drop all user-defined types from sql server database

declare @sqlExecute NVARCHAR(MAX) = N'';

SELECT @sqlExecute = @sqlExecute + N' DROP type '
                   + QUOTENAME(SCHEMA_NAME(schema_id))
                   + N'.' + QUOTENAME(name)
FROM sys.types
WHERE is_user_defined = 1
--print @sqlExecute;
Exec sp_executesql @sqlExecute

No comments:

Post a Comment