| Author |
Topic |
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-06-29 : 16:26:42
|
| Hi,i wanna know something, i inserted some rows of data to a table, but i wanna undo those insertion. How can i do it?thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-29 : 16:33:36
|
| If the data has been committed, then you can't roll it back now.Why not just delete the rows?Do you have transaction log backups? How about a full backup? When was the last backup? Tara Kizeraka tduggan |
 |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-06-29 : 16:36:59
|
| Not committed and i have no idea about transaction log backups |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-29 : 16:38:58
|
| If it wasn't committed, then you can ROLLBACK TRAN still.Tara Kizeraka tduggan |
 |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-06-29 : 16:41:09
|
| BEGIN TRANSACTIONROLLBACK TRANlike this? i did it like above but inserted rows were still there... |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-29 : 16:44:33
|
| BEGIN TRANINSERT INTO YourTable...ROLLBACK TRANThe change that you made must be inside the transaction. If it isn't inside the transaction, then the data is already committed. So you'll either have to delete the rows if you know which ones were inserted or restore from a backup.Tara Kizeraka tduggan |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-30 : 02:07:42
|
| http://www.sommarskog.se/error-handling-I.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2006-06-30 : 09:17:49
|
| SELECT @@TRANCOUNTreturns 0 |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-06-30 : 09:19:51
|
| It sounds like you did not use a transaction when you inserted the data, in which case you'll need to remove the lines manually using DELETEs, or restore from a backup.-------Moo. :) |
 |
|
|
|