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
 EXEC varaiables Problem

Author  Topic 

sammuts
Starting Member

3 Posts

Posted - 2011-07-06 : 05:19:09
Hi,

I am trying to put the following code to call another stored procedure in a stored procedure:

EXEC spa_Insert_SL_TRANSACTIONS
@sClientCode= @sClientCode,
@sOur_Ref = @sOur_Ref,
@nGross_Amount = (@nGross_Amount * -1),
@iNewID = @iSL_Transaction_ID OUTPUT

But everytime I try to compile the stored procedure I get an error "Incorrect syntax near '('." But if I change the line
"@nGross_Amount = (@nGross_Amount * -1)," to
"@nGross_Amount = @nGross_Amount ," it works fine any idea?

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-06 : 05:39:33
You can't do any form of expressions in a stored proc exec call. Set the values before, then just pass them.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -