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
 Transact-SQL (2000)
 Using Stored Proc inside Update query?

Author  Topic 

Sschuster
Starting Member

26 Posts

Posted - 2005-12-21 : 13:26:11
Inside a stored proc I have a series of UPdate commands. One of which needs the result of a another stored proc. The Update is for a temp table.

It looks like this...
Update #Position
Set ClosePrice = PFX_GetClosePriceByCurrency #Position.CurrencyItem, @ToDate

So PFX_GetClosePriceByCurrency takes two parameters. One parameter comes from #Position table itself and the other is a date that is a parameter of the main SP.

My problem is that I continue to get a syntax error saying "Incorrect syntax near '#Position', like it doesn't recognize it.

Some of the other update commands in this SP use similar syntax so it seems that it should work.

This works in the other commands...
Update #Position
Set ProfitLoss_CC = #Position.LongAmount + #Position.ShortAmount

Any ideas? Is there a special syntax you have to use to call a SP from within an Update command?

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2005-12-21 : 13:30:33
you can't use a stored proc in a update statement - you can however use a function - search a bit in books online.

Duane.
"It's a thankless job, but I've got a lot of Karma to burn off."
Go to Top of Page

Sschuster
Starting Member

26 Posts

Posted - 2005-12-21 : 13:36:33
Ahhh. That's what I needed to know. I'll give that a shot. Thanks for the quick reply.
Go to Top of Page
   

- Advertisement -