.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> DataBase >> Post New Resource Bookmark and Share   

 Subscribe to Articles

DROP and TRUNCATE

Posted By:Syed Shakeer Hussain       Posted Date: March 09, 2009    Points: 25    Category: DataBase    URL: http://www.dotnetspark.com  
 

DROP and TRUNCATE

Drop:

 

 When you drop the Table:

1)    All data and structure in the table is deleted

2)    Any Pending transaction are commited

3)    All Indexes are dropped

4)    You cannot RollBack the DROP Table statement.

5)DROP TABLE is commited automatically

6)Indexes, tables, and databases can easily be deleted/removed with the   DROP statement

 

Syntax:

DROP INDEX Syntax for MS SQL Server:

DROP INDEX table_name.index_name

 

The DROP TABLE Statement:

The DROP TABLE statement is used to delete a table

       DROP TABLE dept;

        Table Dropped   

The DROP DATABASE Statement:

The DROP DATABASE statement is used to delete a database.

DROP DATABASE database_name

 

 

Truncate:

 

  When you Truncate a Table

1)    Removes all Rows from a Table

2)    Releses the storage space used by that table

3)    You cannot roll back row removal when using TRUNCATE.

4)    If the table is Parent of a refrential integrity constraint,you cannot truncate the TABLE.Disable the constraint before issuing the TRUNCATE statement.

Syntax:

   

 TRUNCATE TABLE tablename;

 

         tablename is the name of the table.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend