Friday, March 9, 2012

Formating

Hi ,
I want to display the a numeric field column in two decimal
places.
48.00
48.56
But in the Qty is a Number then it is showing as 48.0. How I can get in two
decimal places
Need Help
BabzWhere do you want to display these numbers? What tool are you talking about?
This is an issue with the client tool you are using.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Babz" <notknown@.nodomain.com> wrote in message
news:eL0dzx4lDHA.2080@.TK2MSFTNGP10.phx.gbl...
> Hi ,
> I want to display the a numeric field column in two decimal
> places.
> 48.00
> 48.56
> But in the Qty is a Number then it is showing as 48.0. How I can get in
two
> decimal places
> Need Help
> Babz
>|||Hi
I want this thing in the sql query only.
In the database it is stored as 48.0000. 54.0000, 76.5786.
Even after rounding the value to 2 decimals it is showing in the 4 decimal
places.
I want the data in the following format
48.00
54.00
76.58
Need Help
Babz
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:Oi#15D5lDHA.2616@.TK2MSFTNGP11.phx.gbl...
> Where do you want to display these numbers? What tool are you talking
about?
> This is an issue with the client tool you are using.
> --
> Linchi Shea
> linchi_shea@.NOSPAMml.com
>
> "Babz" <notknown@.nodomain.com> wrote in message
> news:eL0dzx4lDHA.2080@.TK2MSFTNGP10.phx.gbl...
> > Hi ,
> > I want to display the a numeric field column in two decimal
> > places.
> >
> > 48.00
> > 48.56
> > But in the Qty is a Number then it is showing as 48.0. How I can get in
> two
> > decimal places
> >
> > Need Help
> >
> > Babz
> >
> >
>|||I strongly suggest you follow Linchi's suggestion and have your client tool to format the data. If
you are saying that you are using Query Analyzer, I cannot imagine the format being relevant, as I
trust that you can understand the difference between a value and the presentation and format of such
a value. I do assume that you don't use Query Analyzer to present data to end users.
Having said that, if you *really* want to do this in QA, you need to convert the data to a datatype
for which QA presents two digits to the right of the decimal point. ROUND does *not* change
datatype, it only changes the value. So, you need to use CAST for this. Example:
SELECT CAST(3.1 AS decimal(5,2))
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Babz" <notknown@.nodomain.com> wrote in message news:OfDZbj5lDHA.3688@.TK2MSFTNGP11.phx.gbl...
> Hi
> I want this thing in the sql query only.
> In the database it is stored as 48.0000. 54.0000, 76.5786.
> Even after rounding the value to 2 decimals it is showing in the 4 decimal
> places.
> I want the data in the following format
> 48.00
> 54.00
> 76.58
> Need Help
> Babz
>
> "Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
> news:Oi#15D5lDHA.2616@.TK2MSFTNGP11.phx.gbl...
> > Where do you want to display these numbers? What tool are you talking
> about?
> > This is an issue with the client tool you are using.
> >
> > --
> > Linchi Shea
> > linchi_shea@.NOSPAMml.com
> >
> >
> > "Babz" <notknown@.nodomain.com> wrote in message
> > news:eL0dzx4lDHA.2080@.TK2MSFTNGP10.phx.gbl...
> > > Hi ,
> > > I want to display the a numeric field column in two decimal
> > > places.
> > >
> > > 48.00
> > > 48.56
> > > But in the Qty is a Number then it is showing as 48.0. How I can get in
> > two
> > > decimal places
> > >
> > > Need Help
> > >
> > > Babz
> > >
> > >
> >
> >
>|||THANX FOR REPLYING. I am using dataset object to fetch the data and binding
it with the data list view. In this case how I can format in the front end.
I Know it is .Net related question but still any body knows this can answer
for this.
Thanx and Regards
Babz
"Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
wrote in message news:eeYBLp5lDHA.2364@.TK2MSFTNGP11.phx.gbl...
> I strongly suggest you follow Linchi's suggestion and have your client
tool to format the data. If
> you are saying that you are using Query Analyzer, I cannot imagine the
format being relevant, as I
> trust that you can understand the difference between a value and the
presentation and format of such
> a value. I do assume that you don't use Query Analyzer to present data to
end users.
> Having said that, if you *really* want to do this in QA, you need to
convert the data to a datatype
> for which QA presents two digits to the right of the decimal point. ROUND
does *not* change
> datatype, it only changes the value. So, you need to use CAST for this.
Example:
> SELECT CAST(3.1 AS decimal(5,2))
> --
> Tibor Karaszi, SQL Server MVP
> Archive at: http://groups.google.com/groups?oi=djq&as
ugroup=microsoft.public.sqlserver
>
> "Babz" <notknown@.nodomain.com> wrote in message
news:OfDZbj5lDHA.3688@.TK2MSFTNGP11.phx.gbl...
> > Hi
> > I want this thing in the sql query only.
> > In the database it is stored as 48.0000. 54.0000, 76.5786.
> >
> > Even after rounding the value to 2 decimals it is showing in the 4
decimal
> > places.
> >
> > I want the data in the following format
> >
> > 48.00
> > 54.00
> > 76.58
> >
> > Need Help
> >
> > Babz
> >
> >
> >
> > "Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
> > news:Oi#15D5lDHA.2616@.TK2MSFTNGP11.phx.gbl...
> > > Where do you want to display these numbers? What tool are you talking
> > about?
> > > This is an issue with the client tool you are using.
> > >
> > > --
> > > Linchi Shea
> > > linchi_shea@.NOSPAMml.com
> > >
> > >
> > > "Babz" <notknown@.nodomain.com> wrote in message
> > > news:eL0dzx4lDHA.2080@.TK2MSFTNGP10.phx.gbl...
> > > > Hi ,
> > > > I want to display the a numeric field column in two
decimal
> > > > places.
> > > >
> > > > 48.00
> > > > 48.56
> > > > But in the Qty is a Number then it is showing as 48.0. How I can
get in
> > > two
> > > > decimal places
> > > >
> > > > Need Help
> > > >
> > > > Babz
> > > >
> > > >
> > >
> > >
> >
> >
>|||Sorry, I'm not that versed with the GUI elements in .NET. Perhaps some other jumps in here, or you
might want to post a new post with a descriptive subject and also include some relevant .net group
in that post.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Babz" <notknown@.nodomain.com> wrote in message news:e8WAyV7lDHA.2272@.tk2msftngp13.phx.gbl...
> THANX FOR REPLYING. I am using dataset object to fetch the data and binding
> it with the data list view. In this case how I can format in the front end.
> I Know it is .Net related question but still any body knows this can answer
> for this.
> Thanx and Regards
> Babz
> "Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
> wrote in message news:eeYBLp5lDHA.2364@.TK2MSFTNGP11.phx.gbl...
> > I strongly suggest you follow Linchi's suggestion and have your client
> tool to format the data. If
> > you are saying that you are using Query Analyzer, I cannot imagine the
> format being relevant, as I
> > trust that you can understand the difference between a value and the
> presentation and format of such
> > a value. I do assume that you don't use Query Analyzer to present data to
> end users.
> >
> > Having said that, if you *really* want to do this in QA, you need to
> convert the data to a datatype
> > for which QA presents two digits to the right of the decimal point. ROUND
> does *not* change
> > datatype, it only changes the value. So, you need to use CAST for this.
> Example:
> > SELECT CAST(3.1 AS decimal(5,2))
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at: http://groups.google.com/groups?oi=djq&as
> ugroup=microsoft.public.sqlserver
> >
> >
> > "Babz" <notknown@.nodomain.com> wrote in message
> news:OfDZbj5lDHA.3688@.TK2MSFTNGP11.phx.gbl...
> > > Hi
> > > I want this thing in the sql query only.
> > > In the database it is stored as 48.0000. 54.0000, 76.5786.
> > >
> > > Even after rounding the value to 2 decimals it is showing in the 4
> decimal
> > > places.
> > >
> > > I want the data in the following format
> > >
> > > 48.00
> > > 54.00
> > > 76.58
> > >
> > > Need Help
> > >
> > > Babz
> > >
> > >
> > >
> > > "Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
> > > news:Oi#15D5lDHA.2616@.TK2MSFTNGP11.phx.gbl...
> > > > Where do you want to display these numbers? What tool are you talking
> > > about?
> > > > This is an issue with the client tool you are using.
> > > >
> > > > --
> > > > Linchi Shea
> > > > linchi_shea@.NOSPAMml.com
> > > >
> > > >
> > > > "Babz" <notknown@.nodomain.com> wrote in message
> > > > news:eL0dzx4lDHA.2080@.TK2MSFTNGP10.phx.gbl...
> > > > > Hi ,
> > > > > I want to display the a numeric field column in two
> decimal
> > > > > places.
> > > > >
> > > > > 48.00
> > > > > 48.56
> > > > > But in the Qty is a Number then it is showing as 48.0. How I can
> get in
> > > > two
> > > > > decimal places
> > > > >
> > > > > Need Help
> > > > >
> > > > > Babz
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||Have you ensured that your client tool actually holds the value with decimal
places?
The screen output most likely reflects the actual value held.
"Babz" <notknown@.nodomain.com> wrote in message
news:eL0dzx4lDHA.2080@.TK2MSFTNGP10.phx.gbl...
> Hi ,
> I want to display the a numeric field column in two decimal
> places.
> 48.00
> 48.56
> But in the Qty is a Number then it is showing as 48.0. How I can get in
two
> decimal places
> Need Help
> Babz
>

No comments:

Post a Comment