Tuesday, 21 February 2017

Drop All Tables from database using sql query at a time


///   Query


SELECT 'DROP Table [' + TABLE_CATALOG + '].[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']'

FROM INFORMATION_SCHEMA.TABLES


///   Result

DROP Table [DBName][dbo].[HH_Get_Sec_91]
DROP Table [DBName][dbo].[HH_Get_Sec_92]
DROP Table [DBName][dbo].[HH_Get_Sec_9]
DROP Table [DBName][dbo].[HH_Get_Sec_8]
DROP Table [DBName][dbo].[HH_Get_Sec_7_Social]



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...