Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 988
  • Last Modified:

Setting precision of a float data type

I am trying to create a table with a column of type 'float(24)' in SQL Server 2000. When I do that via Enterprise Manager, the Precision field is grayed out, so I cannot change it from the default value of 53. I tried to create a table running a script like this:

CREATE TABLE [dbo].[MyTable] (
      [X] [float(24)] NULL

but I am getting an error "Cannot find data type float(24).". So I have no idea, how the precision can be defined for this data type. Looks like a simple issue, and because of this it's even more frustrating. Can anybody enlighten me, please?
1 Solution
Use Decimal(24,6) instead.  I don't believe float has precision.
Göran AnderssonCommented:
What you are looking for is the data type real.

According to the documentation, you should be able to use float(24) to get a real, but perhaps that doesn't work in SQL Server 2000.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
what kind of data do you want to store, actually?
nebfisAuthor Commented:
Thank you. Yes, according to documentation it should be possible, and that's what irritates me. It's one of the most confusing pieces of documentation I've recently seen. I can declare a variable to be of type float(12), for example, and it works perfectly fine, but I cannot create a table column of this type. Oh, well...
In my case I'll have to go with 'real'.

Using Decimal(24,6) is not a solution because what I need is a number in floating point format.

I have to be able to store numbers in floating point format.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now