July 2, 2007 at 11:38 pm
hi experts,
is there any way to find how many data will update in query before updating them in sql server, i dont want to use select statement bcos its take time.
thanx
July 3, 2007 at 12:23 am
July 3, 2007 at 12:29 am
i m going to update some risky data so in that case i just want to confirm first that how many data r going to update, i can use the ROLLBACK & COMMIT command but i just want to know is ther any way to do this or any tool available for this
thanx
July 3, 2007 at 1:06 am
July 3, 2007 at 1:21 am
no dear i m not using any recordset object i just wann to do this directly thru SQL server/enterprise manager or QA
July 3, 2007 at 2:09 am
Just do a select on the criteria that you are going to update which should fetch the number of rows to be affected.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
July 3, 2007 at 4:36 am
Hi Nitin
If you're going to update some risky data then you would be well advised to check beforehand that everything will work - if you make a mistake and update all 100 million rows instead of the 22 you intended, it will take far longer to put right than the length of time it would take to run a SELECT. You don't have to run a SELECT - you could run your update with something like
SET mycolumn = mycolumn
so nothing is changed.
How about posting your update statement, this will give us a better idea of where you're coming from?
Cheers
ChrisM
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 3, 2007 at 4:46 am
You could change the transaction level, do the update and then read the number of uncommited records and commit the transaction.
N 56°04'39.16"
E 12°55'05.25"
July 3, 2007 at 4:55 am
thanx for yr reply byt could u pls tell me what is procedure to chg the transaction lvl
July 3, 2007 at 5:27 am
Use the SELECT to find out... doesn't matter how much time it takes... it's far better to know ahead of time than fixing "risky data" or having a large rollback occur.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply