Solved

MS SQL Convert Positive Value in Negative

Posted on 2006-07-15
4
678 Views
Last Modified: 2008-02-01
Sir, we are using abs function for converting negative value in positive. I want to convert positive value in Negative. please help if is there any function for converting positive value in negative.

Rgds.
Mehram
0
Comment
Question by:Mehram
  • 2
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17114855
Use something like this

If  @urintValue > 0
  SEt urIntValue =  0 - @urInteValue


There is no ssystem function for this purpose , you can write ur own function to do this with the above logic
0
 

Author Comment

by:Mehram
ID: 17114869
Sir I am using following statement and I want to convert credit column in negative.

select file_job, d='0'+expensecode, headsub, credit, expensedate  
from cargoinvoicedetail where expensecode='0437' and credit > '0' order by 5

In this can i use if, if yes please help how?
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 17114877
select file_job, d='0'+expensecode, headsub, -1*credit, expensedate  
from cargoinvoicedetail where expensecode='0437' and credit > '0' order by 5

0
 

Author Comment

by:Mehram
ID: 17114881
Tks it is excellent
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SAP and ODBC links 2 88
Invalid Identifier Error 3 65
one-way data "masking" MD5 sql 26 97
Has anyone used domo? 1 39
Creating and Managing Databases with phpMyAdmin in cPanel.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now