Showing posts with label integer. Show all posts
Showing posts with label integer. Show all posts

Saturday, February 25, 2012

Changing NULL to zero

Greetings folks,
I have a dilemma that I thought was going to be a slam dunk. I have a
table with several integer and money columns that contain about 50%
null values. I need to sum them, and have the nulls treated as zero.
Secondly, I need to insert all of the values into another table. If
there happens to be a null in the source columns, it needs to become a
zero in the destination. (I know someone is going to fuss about the
storing of calculated values. Not my choice, I don't get a say-so).
The tables have millions of records, and there are roughly 40 int and
money columns. So I'm looking for a solution that will perform well,
and will not require me to update those 40 columns individually. Any
suggestions?
thanks,
CL--isnull will return the column if it is not null, and the second value (in
this case 0) if it is null
select isnull(Column1, 0) from table
or
--Coalesce returns the first non-null value in the list. I think if you
have only one value you want to use isnull, but here is is anyway...
select coalesce(column1,0) from table
"CL" <clhawkins74@.yahoo.com> wrote in message
news:1137790173.259283.202260@.g49g2000cwa.googlegroups.com...
> Greetings folks,
> I have a dilemma that I thought was going to be a slam dunk. I have a
> table with several integer and money columns that contain about 50%
> null values. I need to sum them, and have the nulls treated as zero.
> Secondly, I need to insert all of the values into another table. If
> there happens to be a null in the source columns, it needs to become a
> zero in the destination. (I know someone is going to fuss about the
> storing of calculated values. Not my choice, I don't get a say-so).
> The tables have millions of records, and there are roughly 40 int and
> money columns. So I'm looking for a solution that will perform well,
> and will not require me to update those 40 columns individually. Any
> suggestions?
> thanks,
> CL
>

Friday, February 24, 2012

Changing label of y-axis

For my report i have to change the label of the y-axis. My dataset is
returning integer values "0", "1", "2". These values are now shown as the
label. However, i need to translate these ID's to string values, such as "0"
= "no value available", "1" = "service down", "2" = "service up".
I have tied to insert a code snippet for conditinal names in the Label
Format Code field
=IIF(Fields!Parameter.Value=0, "no values available", Fields!Parameter.Value)
but this does not solve the problem, because it seems i can only use
formatting code in the label field.
Is there a way to do this or do i have to label my y-axis as is and insert a
legend to let the reader of the report know, what that values are meaning?For the series or category (I forget which one is the y-axis), specify the
following instead of just "Fields!myvalue.value"
=IIF(Fields!myValue.value = 0, "No value available",
IIF(Fields!myValue.Value = 1, "Service Down", "Service Up"))
Replace "myvalue" with the actual name of your column.
"Ben" <yogiben_at_gmx_dot_net> wrote in message
news:2B86E61F-186C-4A74-AE0B-EAF85F1DF9C7@.microsoft.com...
> For my report i have to change the label of the y-axis. My dataset is
> returning integer values "0", "1", "2". These values are now shown as the
> label. However, i need to translate these ID's to string values, such as
> "0"
> = "no value available", "1" = "service down", "2" = "service up".
> I have tied to insert a code snippet for conditinal names in the Label
> Format Code field
> =IIF(Fields!Parameter.Value=0, "no values available",
> Fields!Parameter.Value)
> but this does not solve the problem, because it seems i can only use
> formatting code in the label field.
> Is there a way to do this or do i have to label my y-axis as is and insert
> a
> legend to let the reader of the report know, what that values are meaning?