Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE with Call to EXEC SP

Status
Not open for further replies.

richardy

IS-IT--Management
Oct 24, 2002
397
GB
Hi,

I need to use an update statement to update a given field with the results of a stored procedure call (unique id). Theres multiple items in the table without a value

so its something like

update mytable set myid=exec getmyid, @myid output where myid is null

but obviously this doesnt work I can declare @myid and then the exec will return the value correctly to that, and I can set myid=@myid but then the same id would be used for each record which also doesnt work...

Any solutions would be appreciated.

Regards,

Richard.
 
Hi,

not sure what you want exactly but try and look at

@@IDENTITY

in books online

Regards,

Atomic Wedgie
 
Hi Atomic,

Yeah I need to call my own identifier sequence as its none standard so cant use the sql identity columns :(

I guess I need some thing like


update mytable set myid=select (exec getmyid, @myid output) where myid is null



Regards,

Richard.
PRIOR Analytics UK
Winners of the LBA Customer Service Award.
 
Just theoretical. I am not sure if this will works:
Code:
update mytable set myid = {Call getmyid(@myid output)} where myid is null


Borislav Borissov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top