Click here to Skip to main content
15,567,994 members
Home / Discussions / Database
   

Database

 
Questionbegin tran in sql server 2008 Pin
vkEE19-Feb-14 6:22
vkEE19-Feb-14 6:22 
AnswerRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 7:02
professionalGuyThiebaut19-Feb-14 7:02 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 7:13
vkEE19-Feb-14 7:13 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 7:27
professionalGuyThiebaut19-Feb-14 7:27 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 7:43
vkEE19-Feb-14 7:43 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 8:32
professionalGuyThiebaut19-Feb-14 8:32 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 9:25
vkEE19-Feb-14 9:25 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 9:43
professionalGuyThiebaut19-Feb-14 9: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 9:52
professionalEddy Vluggen19-Feb-14 9:52 
GeneralRe: begin tran in sql server 2008 Pin
Ananth A21-Feb-14 1:43
Ananth A21-Feb-14 1:43 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut21-Feb-14 1:56
professionalGuyThiebaut21-Feb-14 1:56 
GeneralRe: begin tran in sql server 2008 Pin
Eddy Vluggen19-Feb-14 9:25
professionalEddy Vluggen19-Feb-14 9:25 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 9:30
vkEE19-Feb-14 9:30 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 9:47
professionalGuyThiebaut19-Feb-14 9:47 
GeneralRe: begin tran in sql server 2008 Pin
vkEE19-Feb-14 9:59
vkEE19-Feb-14 9:59 
GeneralRe: begin tran in sql server 2008 Pin
GuyThiebaut19-Feb-14 11:26
professionalGuyThiebaut19-Feb-14 11:26 
GeneralRe: begin tran in sql server 2008 Pin
Eddy Vluggen19-Feb-14 9:59
professionalEddy Vluggen19-Feb-14 9:59 
AnswerRe: begin tran in sql server 2008 Pin
Corporal Agarn19-Feb-14 9:22
professionalCorporal Agarn19-Feb-14 9:22 
QuestionSQL Server and IDENTITY Pin
gmhanna18-Feb-14 9:33
gmhanna18-Feb-14 9:33 
AnswerRe: SQL Server and IDENTITY Pin
David Mujica18-Feb-14 9:43
David Mujica18-Feb-14 9:43 
GeneralRe: SQL Server and IDENTITY Pin
gmhanna18-Feb-14 10:32
gmhanna18-Feb-14 10:32 
GeneralRe: SQL Server and IDENTITY Pin
Richard Deeming18-Feb-14 12:04
mveRichard Deeming18-Feb-14 12:04 
JokeRe: SQL Server and IDENTITY Pin
ZurdoDev18-Feb-14 16:31
professionalZurdoDev18-Feb-14 16:31 
AnswerRe: SQL Server and IDENTITY Pin
Mycroft Holmes18-Feb-14 12:46
professionalMycroft Holmes18-Feb-14 12:46 
AnswerRe: SQL Server and IDENTITY Pin
S Douglas26-Feb-14 9:24
professionalS Douglas26-Feb-14 9: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.