Home All Groups Group Topic Archive Search About
Author
9 Dec 2005 3:58 PM
fniles
If I create a column with data type Decimal(10,4), when a data is being
stored in that column, will it format the data to be Decimal(10,4) ?
For example: if I enter 1.5, will it be 1.5000, or it will stay as 1.5 ?
When I tried it, it stays at 1.5.

Thanks.

Author
9 Dec 2005 4:13 PM
Stijn Verrept
fniles wrote:

> If I create a column with data type Decimal(10,4), when a data is
> being stored in that column, will it format the data to be
> Decimal(10,4) ?  For example: if I enter 1.5, will it be 1.5000, or
> it will stay as 1.5 ?  When I tried it, it stays at 1.5.

No it will always stay 1.5 because 1.5000 is just a string
representation of a number.  You best handle that in your application.

--

HTH,

Stijn Verrept.
Author
9 Dec 2005 4:17 PM
Raymond D'Anjou
"fniles" <fni***@pfmail.com> wrote in message
news:umjqImN$FHA.2520@TK2MSFTNGP15.phx.gbl...
> If I create a column with data type Decimal(10,4), when a data is being
> stored in that column, will it format the data to be Decimal(10,4) ?
> For example: if I enter 1.5, will it be 1.5000, or it will stay as 1.5 ?
> When I tried it, it stays at 1.5.
>
> Thanks.

I'm going to guess that you're looking at the data in Enterprise Manager.
Go to Query Analyser and Select from that table.
In my SQL Server, EM formats it as 1.5 but in QA, 1.500.
Author
9 Dec 2005 4:35 PM
Raymond D'Anjou
Show quote
"Raymond D'Anjou" <rdanjou@canatradeNOSPAM.com> wrote in message
news:e3yclwN$FHA.4028@tk2msftngp13.phx.gbl...
> "fniles" <fni***@pfmail.com> wrote in message
> news:umjqImN$FHA.2520@TK2MSFTNGP15.phx.gbl...
>> If I create a column with data type Decimal(10,4), when a data is being
>> stored in that column, will it format the data to be Decimal(10,4) ?
>> For example: if I enter 1.5, will it be 1.5000, or it will stay as 1.5 ?
>> When I tried it, it stays at 1.5.
>>
>> Thanks.
>
> I'm going to guess that you're looking at the data in Enterprise Manager.
> Go to Query Analyser and Select from that table.
> In my SQL Server, EM formats it as 1.5 but in QA, 1.500.

Add an extra 0 to that output.
One rule to remember, SQL does not FORMAT data in tables, it stores data.
It will make your life simpler if you remember that rule.
Author
9 Dec 2005 4:32 PM
Trey Walpole
numbers are not stored with a format. format is a matter of display -
e.g., in Query Analyzer look in Tools \ Options \ Connections - see if
Use regional settings is checked.



fniles wrote:
Show quote
> If I create a column with data type Decimal(10,4), when a data is being
> stored in that column, will it format the data to be Decimal(10,4) ?
> For example: if I enter 1.5, will it be 1.5000, or it will stay as 1.5 ?
> When I tried it, it stays at 1.5.
>
> Thanks.
>
>

AddThis Social Bookmark Button