473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

SPROC: How To Change a Value From Positive to Negative??

In a SPROC, How do you Change a Value From Positive to Negative??

I tried something like:
Expand|Select|Wrap|Line Numbers
  1. if @ref = L
  2. set @val = ((select sum([my_val] ) from [table] where [column] = @val_ref) * -1);
  3.  
(I multiply the value X -1) but that does not do it.
What is the proper way to do it?

Thank you for your help,

A newbie
Jun 27 '07 #1
1 4310
In a SPROC, How do you Change a Value From Positive to Negative??

I tried something like:
Expand|Select|Wrap|Line Numbers
  1. if @ref = L
  2. set @val = ((select sum([my_val] ) from [table] where [column] = @val_ref) * -1);
  3.  
(I multiply the value X -1) but that does not do it.
What is the proper way to do it?

Thank you for your help,

A newbie
You need to pay careful attention to you aggregate function. What you are looking for is:

Expand|Select|Wrap|Line Numbers
  1. (sum([my_val] )  * -1)
And remove the * -1 from the end.
Let me know if it help you out
Jun 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: cylin | last post by:
Hi all, If I have a variable and it's just have 22 bits, and I must set this variable unsigned integer. This 2's complement value maybe is negative. For example: A= 11 1111 1111 1110 ...
7
by: pj | last post by:
Why does M$ Query Analyzer display all numbers as positive, no matter whether they are truly positive or negative ? I am having to cast each column to varchar to find out if there are any...
5
by: Peter Bailey | last post by:
I have an expression that returns the week number in a row but descending from a date: Week Number: DateDiff("ww",DateAdd("ww",1,forms!FrmBookingCurveInput!TxtStart.value),) It allows me to...
29
by: Peter Ammon | last post by:
What's the most negative double value I can get? Is it always guaranteed to be -DBL_MAX? If so, why (or rather, where)? Thanks.
19
by: Harshan | last post by:
The range of signed int is - 2^15 to + (2^15 )-1 (-32768 to 32767) Why the one less at positive Range ? (compared to the negative side..!) I came to know that it uses 2's compliment...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
3
by: Henrootje | last post by:
I have a lot of tables that hold a lot of numeric fields. The names of all of these tables start with ' tblRO' Now it turns out that all of the numeric fields with type double precision have the...
2
by: rvazque | last post by:
I want to find out if a specific value in a field is a Negative value or a Positive values. Examples of values: -5, 6, -44.65, 1247, -1.9 Is there a function in MS Access or code to determine...
1
by: vikastcser | last post by:
Hi All , I have a table where four rows are there and each row has two tds.one td is for label and two image icons and other td is used for keeping numeric values. I am able to accomodate digits...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.