|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
sorry, how do I delete in SQL
I think its a really easy Q for those who know, I dont know a thing about sql but a contractor has stuffed me and I need to remove all the test data from a bunch of tables in a database.
Is there an easy way (or a way) to remove all the info in the rows of data in numerous tables without me messing up the tables for future use? I though using query manager and just DELETE * FROM table_name is that going to mess things up? Appreciate the help. |
|
#2
|
|||
|
|||
|
Code:
DELETE FROM table_name The * shouldn't be there. That will remove all records from the table. |
|
#3
|
|||
|
|||
|
that is what I want, there are a few different tables and I just want to empty all the data that is there. Is there a difference?
|
|
#4
|
|||
|
|||
|
DELETE FROM table_name
Yes. That command will just straight out remove all the data in the table. It will not however reset the value for the auto_increment on the ID column you use in the table. I'm still trying to find out how to reset it.
|
|
#5
|
|||
|
|||
|
thanks
|
|
#6
|
|||
|
|||
|
An alternative approach is "truncate table table_name."
__________________
Lucas Alexander http://www.alexanderdevelopment.net |
|
#7
|
|||
|
|||
|
Quote:
There is absolutely no difference between DELETE FROM table and DELETE * FROM table. Both commands delete all records. |
|
#8
|
|||
|
|||
|
The syntax
Code:
delete * from t is specific to Access. It does not work in any other DBMS AFAIK, |
|
#9
|
|||
|
|||
|
I have to apologize...
I do not even work with Access, but I was so sure that DELETE * FROM was SQL standard (and understood by most DBMS that I know), that I didn't even bother to check it. But not even SQL Server accepts it... I know better next time ![]() Cheers Thomas |
|
#10
|
|||
|
|||
|
delete or truncate?
why not do a truncate table?
TRUNCATE table table_name thanks rik |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > sorry, how do I delete in SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|