Hey - I have a quick question and know that it is probably pretty simple, but I am stumped. I have a query where I need to make a colum a number that looks like a percent with 2 significant digits:
i.e.,
SELECT tblNumericCovert.number1, tblNumericCovert.number2, [number1]/[number2] AS testDiv
FROM tblNumericCovert
where testDiv needs to spit out results like this ###.##
I am totally lost, if anyone can help, I would appreciate it.cast(cast(YourValue as decimal(10,2)) as varchar(6)) + '%'
But really, data formatting issues should be handled by the interface, not sql server. Do your formatting in Crystal, VB, ASP, Excel, or whatever else you are using to display results.|||It will do the rounding though:
select right('000000'+ltrim(str(123.87745, 6, 2)), 6) + '%'|||Probably better to use ROUND for rounding, so you know what you are trying to accomplish when you look at your code...
SELECT ROUND(127.4355,2) = 127.4400|||Makes sense.|||Originally posted by rdjabarov
Makes sense.
That works perfectly! Thanks. I've always used Access which is a breeze and I'm trying to use SQL more. I really appreciate all of y'alls help on this.
Showing posts with label colum. Show all posts
Showing posts with label colum. Show all posts
Wednesday, March 21, 2012
Sunday, February 26, 2012
Format matrix subtotal column
I have a matrix that has columns for each quarter of the year and I added a
subtotal colum for the year total. I would like to have the data cells in the
subtotal column be a different color than that of the the quarter columns. I
thought that using the little green triangle in the subtotal cell would work,
but it doesn't. How can I do this?
Thanks...
Regards,
SteveIt is the little green triangle - BackgroundColor in Subtotal properties.
You also have to assign a BackgroundColor for the textbox that is your column
heading.
Do you have some expression overriding it?
daw
"Steve" wrote:
> I have a matrix that has columns for each quarter of the year and I added a
> subtotal colum for the year total. I would like to have the data cells in the
> subtotal column be a different color than that of the the quarter columns. I
> thought that using the little green triangle in the subtotal cell would work,
> but it doesn't. How can I do this?
> Thanks...
> Regards,
> Steve|||For some reason I can't get it to work on a column subtotal, but it works
fine for a row subtotal. No expressions overriding it far as I can see.
The BackgroundColor for the column heading is LightSkyBlue, but changing the
BackgroundColor on the subtotals textbox to, say Red, using the little green
arrow has no effect.
I was able to get it to work by setting the BackgroundColor property in the
data cell, i.e. the one with the sum in it, using this expression:
=iif(InScope("matrix3_ColumnGroup2"),"Quarter totals","Year totals")
Thanks,
Steve
"daw" wrote:
> It is the little green triangle - BackgroundColor in Subtotal properties.
> You also have to assign a BackgroundColor for the textbox that is your column
> heading.
> Do you have some expression overriding it?
> daw
> "Steve" wrote:
> > I have a matrix that has columns for each quarter of the year and I added a
> > subtotal colum for the year total. I would like to have the data cells in the
> > subtotal column be a different color than that of the the quarter columns. I
> > thought that using the little green triangle in the subtotal cell would work,
> > but it doesn't. How can I do this?
> >
> > Thanks...
> >
> > Regards,
> > Steve
subtotal colum for the year total. I would like to have the data cells in the
subtotal column be a different color than that of the the quarter columns. I
thought that using the little green triangle in the subtotal cell would work,
but it doesn't. How can I do this?
Thanks...
Regards,
SteveIt is the little green triangle - BackgroundColor in Subtotal properties.
You also have to assign a BackgroundColor for the textbox that is your column
heading.
Do you have some expression overriding it?
daw
"Steve" wrote:
> I have a matrix that has columns for each quarter of the year and I added a
> subtotal colum for the year total. I would like to have the data cells in the
> subtotal column be a different color than that of the the quarter columns. I
> thought that using the little green triangle in the subtotal cell would work,
> but it doesn't. How can I do this?
> Thanks...
> Regards,
> Steve|||For some reason I can't get it to work on a column subtotal, but it works
fine for a row subtotal. No expressions overriding it far as I can see.
The BackgroundColor for the column heading is LightSkyBlue, but changing the
BackgroundColor on the subtotals textbox to, say Red, using the little green
arrow has no effect.
I was able to get it to work by setting the BackgroundColor property in the
data cell, i.e. the one with the sum in it, using this expression:
=iif(InScope("matrix3_ColumnGroup2"),"Quarter totals","Year totals")
Thanks,
Steve
"daw" wrote:
> It is the little green triangle - BackgroundColor in Subtotal properties.
> You also have to assign a BackgroundColor for the textbox that is your column
> heading.
> Do you have some expression overriding it?
> daw
> "Steve" wrote:
> > I have a matrix that has columns for each quarter of the year and I added a
> > subtotal colum for the year total. I would like to have the data cells in the
> > subtotal column be a different color than that of the the quarter columns. I
> > thought that using the little green triangle in the subtotal cell would work,
> > but it doesn't. How can I do this?
> >
> > Thanks...
> >
> > Regards,
> > Steve
Subscribe to:
Posts (Atom)