Tuesday, 21 February 2017

Drop All User-Defined Types from SQL Server database at a time

//////  Query

Select  'DROP TYPE ' + quotename(schema_name(schema_id)) + '.' + quotename(name) from sys.types

Where is_user_defined = 1


// // REsult

DROP TYPE [dbo].[Type_tblHH]
DROP TYPE [dbo].[Type_tblHH_ConsumerGoods]
DROP TYPE [dbo].[Type_tblHH_Crops]
DROP TYPE [dbo].[Type_tblHH_Deceased]

DROP TYPE [dbo].[Type_tblHH_DrinkingWater]


run execute command and get result

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...