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)
 Update and Case problem ?

Author  Topic 

oguzkaygun
Yak Posting Veteran

53 Posts

Posted - 2012-04-15 : 06:31:57
Hello
Below query give me error. What can be problem ?
@_borc is 100 and @x_id is 6
UPDATE x_carikarti
SET x_bakiye = CASE WHEN x_borcalacak = 'B' THEN x_bakiye - @x_borc WHEN x_borcalacak = 'A' THEN x_bakiye + @x_borc END
WHERE (x_id = @x_id)

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-15 : 08:33:29
The error message would indicate what the problem is. The syntax looks fine. If you post the error message people on this forum would be able to offer more concrete advice.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-15 : 15:09:46
my guess is data type of x_bakiye is incompatible with datatype of variable @x_borc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

financing

1 Post

Posted - 2012-04-16 : 04:44:17
The syntax looks fine. If you post the error message people on this forum would be able to offer more concrete advice.

unspammed
Go to Top of Page
   

- Advertisement -