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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Check before committing a Update statement?

Author  Topic 

Maverick_
Posting Yak Master

107 Posts

Posted - 2011-05-03 : 10:02:37
Hi all,

I am going to be writing a series of serious update statements in SQL Server.

Before I hit the Execute button is it possible to see how many rows its going to affect, before the final execution? Not sure if there a button that can show you this 'Preview' or whether I need some prefixed SQL(?)

Any help would be appreciated.

I am using SQL Server 2005.

Cheers

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-03 : 10:06:44
do it in a transaction and check the rowcounts before the commit.

change the update to a select count(*) - just put the select count(*) before the from clause and run that.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Maverick_
Posting Yak Master

107 Posts

Posted - 2011-05-03 : 10:09:49
That sounds good, cheers Nigel :)
Go to Top of Page
   

- Advertisement -