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)
 Declaring Variables In Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-07-24 : 07:56:53
Seth writes "I'm trying to write a stored procedure that performs a select command and then an update command. The update command is performed on the record that returned from the select command. It seems to me the most likely way to do this is to put the two values from the select record into variables and use these variables in the update command. Is this the way to do what i want? thanks,

Seth"

dsdeming

479 Posts

Posted - 2003-07-24 : 08:22:45
Why not just write an UPDATE statement? If the WHERE clause is the same as the where clause you're currently using in you SELECT statement, it will only update the data you would have selected. No need to select first and then update.

Dennis
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-07-24 : 09:56:10
Use the force Luke..

umm

Think Set processing, Seth

If you already know how to select a Set of data based on a certain Where clause (predicate), you can update all of the data using the same manner in one process...

And it seems you haven't gotten to cursors yet, so stay away (unless you have to of course)




Brett

8-)
Go to Top of Page
   

- Advertisement -