|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Decimal data typeIf 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. fniles wrote:
> If I create a column with data type Decimal(10,4), when a data is No it will always stay 1.5 because 1.5000 is just a string> 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. representation of a number. You best handle that in your application. -- HTH, Stijn Verrept. "fniles" <fni***@pfmail.com> wrote in message I'm going to guess that you're looking at the data in Enterprise Manager.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. Go to Query Analyser and Select from that table. In my SQL Server, EM formats it as 1.5 but in QA, 1.500.
Show quote
"Raymond D'Anjou" <rdanjou@canatradeNOSPAM.com> wrote in message Add an extra 0 to that output.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. 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. 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. > > |
|||||||||||||||||||||||