views:

129

answers:

2

trying to run the following statement in sql mgmt studio

declare @rick as decimal(13,3)
@rick = -.5
select bob = abs(@rick)

any ideas why this won't work?

+1  A: 

You were missing a Set on line 2. With that, I get the proper .5. I.e.:

declare @rick as decimal(13,3)
set @rick = -.5
select bob = abs(@rick)
Stu
There is a Set on line two, I can't see that there should be more than one?
Guffa
The Set on line two is there because I added it. Will edit to be more clear.
Stu
Yeah, I agree with Stu. Missing SET is the only problem.
Zinx
is the set assumed when you're working with a cursor?
phill
No. Without a SET (or SELECT, that would work as well in this case), the second line isn't a valid SQL statement -- period.
Stu
+1  A: 

It works fine over here, bob = 0.500. What error do you get?

Damir Sudarevic