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
 Transact-SQL (2000)
 change a possitive into a negative value

Author  Topic 

davecarrera
Starting Member

4 Posts

Posted - 2007-05-29 : 03:00:32
Hi All,

I have a result that for whatever reason has account credits posted to table as a positive number.

What i would like to do is add a dynamic colomn to my result that says something like if ref like 'CN%%%%%%%' then newvalue=val*-1 (to make it a negative value) else it stays positive.

I am not very clued up on this and i should say that this is via RS so any help or advise is really appreciated.

Kind Reagards

Dave

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-29 : 03:04:01
Please post in appropriate forum.

select case when ref like 'CN%' then -val else val end as new_column
from yourtable



KH

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-29 : 07:07:07
moved from Article discussion.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

davecarrera
Starting Member

4 Posts

Posted - 2007-05-29 : 07:10:26
Sorry about posting in wrong area. Only noticed after i did it, silly me.... :-)

Thanks for the help Khtan, will give that ago

Many thanks

Dave
Go to Top of Page
   

- Advertisement -