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 2008 Forums
 Transact-SQL (2008)
 WHAT COULD CAUSE THIS, HELP!

Author  Topic 

aserwin
Starting Member

2 Posts

Posted - 2010-08-26 : 12:26:25
In a stored proc, I have a variable (@newsavings) that when I just print it out, or select it into its own table, it shows as I expect.

BUT! When I update another table (UPDATE ... SET Amount=@newsavings) it enters the new table as 0.00 (decimal(18,2) field)

What would cause this?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-08-26 : 12:42:51
Are you returning the value for the variable from stored procedure. If yes then make sure you have specified output statement.
If no then please post the code of the SP so that we have help you.




Go to Top of Page

aserwin
Starting Member

2 Posts

Posted - 2010-08-26 : 12:49:54
SELECT ClientKey = @clientkey,
Amount = @newsavings,
AccountID = @Account_ID

---

UPDATE Client_Budget SET Amount = @newsavings,
EntryDate = CURRENT_TIMESTAMP
WHERE ClientKey = @clientkey

---
The first statement brings back what I expect.
After the second statement executes, Client_Budget shows 0.00 in Amount.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-08-26 : 13:26:38
Please post the entire code of the stored proc.

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

- Advertisement -