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)
 Adding in Stored Procedure

Author  Topic 

Pace
Constraint Violating Yak Guru

264 Posts

Posted - 2006-07-28 : 04:40:58
Hi all,

4 years ive been using this site but im afraid I need to post

I have a proc that has two declarations

@cost
@extraCost

now im trying to pass these to another proc after some calculations and it kind of looks like this

EXEC stp_someOther @1, @2, @cost + @extraCost

Both cost and extraCost are of type decimal(18,2) but computer says no and I get invalid syntax near "+"

Can someone please help me work out why?

Thank you!

Pace

when life hands you lemons, ask for tequila and salt

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-07-28 : 04:43:01
do the math inside the sp or before you pass it to the sp

--------------------
keeping it simple...
Go to Top of Page

Pace
Constraint Violating Yak Guru

264 Posts

Posted - 2006-07-28 : 04:49:25
Thanks Jen...

Dont think I have done that before... im a .net dev by trade... my godly sql dude has decided to sun himself in some foreign country... can you show me how I would do the calculation if possible?

@calcCost = @cost + @extraCost doesnt seem to work...

when life hands you lemons, ask for tequila and salt
Go to Top of Page

Pace
Constraint Violating Yak Guru

264 Posts

Posted - 2006-07-28 : 04:50:39
Ahh ahh!

SET @calcCost = @cost + @extraCost

Wootness!

when life hands you lemons, ask for tequila and salt
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-29 : 01:20:02
or

SELECT @calcCost = @cost + @extraCost


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -