Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal Place precision, poss to store to 13 dec places?

Status
Not open for further replies.

LucieLastic

Programmer
May 9, 2001
1,694
GB
hi

Trying to store numbers accurately to 13 decimal places but Float type seems to truncate the number and couldn't get it to work using Decimal type.

Is it possible to store numbers (without any sort of round) to this precision?

Many thanks in advance,
Lou

www.radbmx.co.uk
 
>> couldn't get it to work using Decimal type.

Why not?

Here's an example that stores the number in a variable but would work just as well in a field.

Code:
Declare @Temp Decimal(28,13)

Set @Temp = 1234567890123.1234567890123

Select @Temp

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Perhaps something like this?

Code:
select convert(decimal (15,13), MyColumn)

Ignorance of certain subjects is a great part of wisdom
 
Thanks everyone, I stupidly hadn't allowed enough in the precision field! Now all working.

Thanks again.

www.radbmx.co.uk
 
I beleive you can use the decimal data type e.g. decimal(38, 15) will store what you wish. Caveat, Ive never used this in a production environment, so it would be a good idea to test it thoroughly.

There are some other issues with using these data types - see BOL.

"There are only two lasting bequests we can hope to give our children; one of these is roots, the other wings" - Hodding Carter
 
That'll teach me not to refresh before I post :)

"There are only two lasting bequests we can hope to give our children; one of these is roots, the other wings" - Hodding Carter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top