Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2007-02-05 : 10:41:35
|
| Is there antway I can get the Query Analyser to prompt me with a message saying '234 records will be updated' and then give me the option to continue or not.I want to run an update query but want to see how many records it will update first. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-05 : 10:45:56
|
| Highlight the Update statement by selecting it and press Ctrl + L. In the estimated execution plan, check the final Estimated Row count value.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2007-02-05 : 10:51:56
|
| Thanks. |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2007-02-05 : 10:58:43
|
Or u may usebegin tran Update ..........-- If OK commit-- If not OK rollback Srinika |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2007-02-08 : 06:50:10
|
| I get this errorThe ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.begin transUpdate RDset Dept = R.Deptfrom tblFileRequestDetailsCopy as RDJOIN tblFileRequests as Ron RD.MovementId = R.MovementIdwhere RD.dept is null-- If OK commit-- If not OK rollback |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-08 : 07:01:41
|
Don't just copy replies posted here. Try to understand the logic behind them.What Srinika meant was:Begin TransactionUpdate RDset Dept = R.Deptfrom tblFileRequestDetailsCopy as RDJOIN tblFileRequests as Ron RD.MovementId = R.MovementIdwhere RD.dept is nullIf @@error = 0 -- OK Commit TransactionElse -- not OK Rollback Transaction Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
Pinto
Aged Yak Warrior
590 Posts |
Posted - 2007-02-08 : 10:32:25
|
| Don't just copy replies posted here. Try to understand the logic behind them.This forum is called New to SQL Server. I am self taught off the web and do look up the keywords etc that I am given here. I also have a library of code that has helped me that kind people have given me on sites such as these. Hopefully, one day I will be as well knowledged in SQL as you Harsh Athalye and will be able to help others.I do not look for the easy, lazy way to code by pinching others code or getting others to write it for me. Often, I have searched for hours for the solution before posting here. Sometimes though, you need to know part of the solution to be able to find it all.You have helped me often Harsh Athalye and I have before, and do thank you for that. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-02-09 : 02:59:01
|
| I know it is difficult for newbies to understand seemingly complex code. But if you could have done some search firstly in the SQL Server help files regarding transactions and corresponding examples, you could have easily spotted your mistake. You will only learn when you try to find out the solution on your own.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|