Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

Dropping Multiple SQL Server Objects In Single Line

Feb 3 2012 12:00AM by bulentgucuk (draft)   

As humans we try to find a way to work faster and efficient. As data professionals, typing less probably is another thing we want. My SQL Server tip today is about dropping multiple objects (tables, views, stored procedures, and even databases) in single drop statement. This is powerful but can be dangerous in production so please use caution. Here is a script that creates couple of tables and then drops both tables in single drop statement.

Sincerely,

Bulent

-- CREATE TABLES

USE tempdb

GO

CREATE TABLE dbo.TableT1 (t1c1 TINYINT)

CREATE TABLE dbo.TableT2 (t2c1 TINYINT)

GO

INSERT INTO dbo.TableT1 VALUES(1)

INSERT INTO dbo.TableT2 VALUES(2)

GO

-- CHECK THE TABLES CREATED

SELECT *

FROM sys.tables

WHERE name LIKE 'TableT_'

GO

-- DROP BOTH TABLES IN SINGLE DROP STATEMENT

DROP TABLE dbo.TableT1, dbo.TableT2

GO

-- CHECK THE TABLES DROPPED

SELECT *

FROM sys.tables

WHERE name LIKE 'TableT_'

GO

Read More..   [32134 clicks]

Published under:  ·  ·  ·  · 

  • Previous: 
  • Next: 

bulentgucuk
381 · 0% · 105
1
 
0
Knew
 
0
Learned
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

1  Comments  

  • This is certainly a very helpful tip. Interestingly there is already a similar tip submitted some time ago. You can find it here.

    We are working on providing a search functionality so that we can do a search for existing tips before submitting a new one.

    commented on Feb 9 2012 1:51AM
    Jacob Sebastian
    1 · 100% · 32004

Your Comment


Sign Up or Login to post a comment.

"Dropping Multiple SQL Server Objects In Single Line" rated 5 out of 5 by 1 readers
Dropping Multiple SQL Server Objects In Single Line , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]