Home > Archive > MS SQL Server > October 2006 > SQL Server 2000 Datatype and length question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL Server 2000 Datatype and length question
Jason Huang

2006-10-24, 6:37 pm

Hi,

In my SQL Server 2000, a column Tax which datatype is float and it's default
length is 10.
But in my SQl Query Analyzer, when I SELECT from the
INFORMATION_SCHEMA.COLUMNS, it's Numecir_Precision is 53. Why it's not 10?
How do I request the length of the Datatype Int, SmallInt, TinyInt,float,
bit, smalldatetime?
Thanks for help.


Jason


Sylvain Lafontaine

2006-10-24, 6:37 pm

Length is the number of bytes required to store the float (should be 8 for
the float type, not 10) and NumericPrecision is the number of digits that
can be displayed.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"Jason Huang" < JasonHuang8888@hotma
il.com> wrote in message
news:%23KJfgqn7GHA.4708@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> In my SQL Server 2000, a column Tax which datatype is float and it's
> default length is 10.
> But in my SQl Query Analyzer, when I SELECT from the
> INFORMATION_SCHEMA.COLUMNS, it's Numecir_Precision is 53. Why it's not
> 10?
> How do I request the length of the Datatype Int, SmallInt, TinyInt,float,
> bit, smalldatetime?
> Thanks for help.
>
>
> Jason
>
>



Jason Huang

2006-10-24, 6:37 pm

Thanks Sylvain.
Yep, the length of the float datatype is 8, not 10.
But how do I get the '10' from the SELECT command?


Jason





"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)> 撰寫於郵件新聞:eb%23
ol%23n7GHA.4064@TK2MSFTNGP03.phx.gbl...
> Length is the number of bytes required to store the float (should be 8 for
> the float type, not 10) and NumericPrecision is the number of digits that
> can be displayed.
>
> --
> Sylvain Lafontaine, ing.
> MVP - Technologies Virtual-PC
> E-mail: http://cerbermail.com/?QugbLEWINF
>
>
> "Jason Huang" < JasonHuang8888@hotma
il.com> wrote in message
> news:%23KJfgqn7GHA.4708@TK2MSFTNGP05.phx.gbl...
>
>



Dan Guzman

2006-10-24, 6:37 pm

> In my SQL Server 2000, a column Tax which datatype is float and it's
> default length is 10.


The float data type is a fixed length of 4 or 8 bytes depending on the
precision. The precision will be either 24 or 53, depending on the
precision specified when the column was created. If no precision is
specified, the max precision of 53 is used so the storage size will be 8
bytes.


> But in my SQl Query Analyzer, when I SELECT from the
> INFORMATION_SCHEMA.COLUMNS, it's Numecir_Precision is 53. Why it's not
> 10?
> How do I request the length of the Datatype Int, SmallInt, TinyInt,float,
> bit, smalldatetime?


The ANSI standard INFORMATION_SCHEMA don't expose physical characteristics.
You can get the storage length of these types by querying dbo.systypes:

SELECT name, length FROM dbo.systypes


--
Hope this helps.

Dan Guzman
SQL Server MVP
"Jason Huang" < JasonHuang8888@hotma
il.com> wrote in message
news:%23KJfgqn7GHA.4708@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> In my SQL Server 2000, a column Tax which datatype is float and it's
> default length is 10.
> But in my SQl Query Analyzer, when I SELECT from the
> INFORMATION_SCHEMA.COLUMNS, it's Numecir_Precision is 53. Why it's not
> 10?
> How do I request the length of the Datatype Int, SmallInt, TinyInt,float,
> bit, smalldatetime?
> Thanks for help.
>
>
> Jason
>
>


Sylvain Lafontaine

2006-10-24, 6:37 pm

The numeric_precision_ra
dix indicates that when required, the decimal part
of numbers with a too great precision will be truncated using the rules of
the decimal or base 10 representation. The other possibility is base 2
representation.

Excerpt for advanced math packages, this value should always be 10.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


"Jason Huang" < JasonHuang8888@hotma
il.com> wrote in message
news:%23TtVJbo7GHA.4404@TK2MSFTNGP04.phx.gbl...
> Thanks Sylvain.
> Yep, the length of the float datatype is 8, not 10.
> But how do I get the '10' from the SELECT command?
>
>
> Jason
>
>
>
>
>
> "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
> 撰寫於郵件新聞:eb%23
ol%23n7GHA.4064@TK2MSFTNGP03.phx.gbl...
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com