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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 HT Determine if Update is Successful?

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2004-01-07 : 20:50:35
How can I determine if an update was made? In other words, how can I determine if there was a stock.number=stock_remote.number in the example below?

UPDATE stock_remote ;
SET units=stock.units ;
where stock.number=stock_remote.number

Is there some sort of _tally that can be used? If > 0 then it was successful? Or would I first have to use a select * from stock_remote where stock.number=stock_remote.number to see if it found the item to be updated.

Thanks in advance.

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2004-01-07 : 21:51:05
System variable @@error:

UPDATE ... ...
if @@error<>0 print 'Update failed!!'
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-01-07 : 21:53:19
SELECT @@ROWCOUNT I think that's what you are looking for.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -