Author |
Topic |
tkotey
Yak Posting Veteran
75 Posts |
Posted - 2008-07-12 : 04:51:48
|
What is the difference between drop table and delete table |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-12 : 04:57:54
|
quote: Originally posted by tkotey What is the difference between drop table and delete table
Did you see the information in sql server help file?MadhivananFailing to plan is Planning to fail |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-12 : 11:17:44
|
quote: Originally posted by tkotey What is the difference between drop table will drop whole table and delete table will only delete data
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-12 : 14:43:07
|
drop table is DDL statement which drops the table itself while delete table keeps the table and removes only the data and hence is DML. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-12 : 14:49:46
|
quote: Originally posted by tkizer There is no DELETE TABLE statement in SQL Server.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
sorry my bad. i meant DELETE FROM Table |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
|
laddu
Constraint Violating Yak Guru
332 Posts |
Posted - 2008-07-12 : 15:17:02
|
quote: Originally posted by tkotey What is the difference between drop table and delete table
DELETE TABLE cmd removes the rows from a table based on the condition that we provide with a WHERE clause.DELETE TABLE can be rolled back. DROP TABLE cmd drops the total table |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-07-12 : 15:28:05
|
quote: Originally posted by sodeep
quote: Originally posted by tkizer There is no DELETE TABLE statement in SQL Server.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
you can use DELETE TABLE(TABLENAME)
No you can't, so prove it. BOL doesn't give any indication of this either.Here's my test:SQL Server 2000:create table table1 (col1 int)delete table (table1)Error:Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'table'.SQL Server 2005:create table table1 (col1 int)delete table (table1)Error:Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'table'.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-12 : 15:30:07
|
quote: Originally posted by tkizer
quote: Originally posted by sodeep
quote: Originally posted by tkizer There is no DELETE TABLE statement in SQL Server.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
you can use DELETE TABLE(TABLENAME)
No you can't, so prove it. BOL doesn't give any indication of this either.Here's my test:SQL Server 2000:create table table1 (col1 int)delete table (table1)Error:Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'table'.SQL Server 2005:create table table1 (col1 int)delete table (table1)Error:Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'table'.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
But you can use DELETE table1.just realised FROM is optionalhttp://doc.ddart.net/mssql/sql70/de-dz_5.htm |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-12 : 16:05:45
|
quote: Originally posted by tkizer
quote: Originally posted by sodeep
quote: Originally posted by tkizer There is no DELETE TABLE statement in SQL Server.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
you can use DELETE TABLE(TABLENAME)
No you can't, so prove it. BOL doesn't give any indication of this either.Here's my test:SQL Server 2000:create table table1 (col1 int)delete table (table1)Error:Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'table'.SQL Server 2005:create table table1 (col1 int)delete table (table1)Error:Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'table'.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
What I meant was exactly what visakh said. And how can we use DELETE Table tablename since delete doesn't touch structure of table which has already been stated. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-07-12 : 16:20:44
|
I've never said anything about structure. My whole point is that DELETE TABLE is not a valid T-SQL command. Please re-read all of my posts in this thread.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
|