Click here to Skip to main content
15,889,874 members
Home / Discussions / Database
   

Database

 
Questionbegin tran in sql server 2008 Pin
vkEE19-Feb-14 5:22
vkEE19-Feb-14 5:22 
AnswerRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 6:02
professionalGuyThiebaut19-Feb-14 6:02 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 6:13
vkEE19-Feb-14 6:13 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 6:27
professionalGuyThiebaut19-Feb-14 6:27 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 6:43
vkEE19-Feb-14 6:43 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 7:32
professionalGuyThiebaut19-Feb-14 7:32 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 8:25
vkEE19-Feb-14 8:25 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 8:43
professionalGuyThiebaut19-Feb-14 8:43 
I don't think you read my post fully.

Before the update run a query like this:
SQL
select * into temp_20140219 from cash_withdrawals where userid = 1234

You then run your update:
SQL
update cash_withdrawals set withdrawals = -1000000 where id = 1234

You then check that the update worked correctly:
SQL
select * from cash_withdrawals where userid = 1234

If everything looks correct you then drop the backup table.
SQL
drop table temp_20140219


If there is a problem you restore the data:
SQL
delete from cash_withdrawals where id = 1234
insert into cash_withdrawals
select * from temp_20140219


If you carry on with things the way you currently do you will get burnt, maybe not this weeek but it will happen eventually...

[EDIT]SQL syntax error corrected[/EDIT]
“That which can be asserted without evidence, can be dismissed without evidence.”

― Christopher Hitchens

GeneralRe: begin tran in sql server 2008 Pin
Eddy Vluggen19-Feb-14 8:52
professionalEddy Vluggen19-Feb-14 8:52 
GeneralRe: begin tran in sql server 2008 Pin
Ananth A21-Feb-14 0:43
Ananth A21-Feb-14 0:43 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut21-Feb-14 0:56
professionalGuyThiebaut21-Feb-14 0:56 
GeneralRe: begin tran in sql server 2008 Pin
Eddy Vluggen19-Feb-14 8:25
professionalEddy Vluggen19-Feb-14 8:25 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 8:30
vkEE19-Feb-14 8:30 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 8:47
professionalGuyThiebaut19-Feb-14 8:47 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 8:59
vkEE19-Feb-14 8:59 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 10:26
professionalGuyThiebaut19-Feb-14 10:26 
GeneralRe: begin tran in sql server 2008 Pin
Eddy Vluggen19-Feb-14 8:59
professionalEddy Vluggen19-Feb-14 8:59 
AnswerRe: begin tran in sql server 2008 Pin
Corporal Agarn19-Feb-14 8:22
professionalCorporal Agarn19-Feb-14 8:22 
QuestionSQL Server and IDENTITY Pin
gmhanna18-Feb-14 8:33
gmhanna18-Feb-14 8:33 
AnswerRe: SQL Server and IDENTITY Pin
David Mujica18-Feb-14 8:43
David Mujica18-Feb-14 8:43 
GeneralRe: SQL Server and IDENTITY Pin
gmhanna18-Feb-14 9:32
gmhanna18-Feb-14 9:32 
GeneralRe: SQL Server and IDENTITY Pin
Richard Deeming18-Feb-14 11:04
mveRichard Deeming18-Feb-14 11:04 
JokeRe: SQL Server and IDENTITY Pin
ZurdoDev18-Feb-14 15:31
professionalZurdoDev18-Feb-14 15:31 
AnswerRe: SQL Server and IDENTITY Pin
Mycroft Holmes18-Feb-14 11:46
professionalMycroft Holmes18-Feb-14 11:46 
AnswerRe: SQL Server and IDENTITY Pin
S Douglas26-Feb-14 8:24
professionalS Douglas26-Feb-14 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.