ScuzzyJo
asked on
MS SQL 2012 Add Column as Float Adds it as Real
Hi
This is really annoying me! I have 2 lines which state:
ALTER TABLE ROSS_LIVE ADD Net_Amount float (20) default (0) NOT NULL;
GO
It creates the column but as a real, not a float. Could someone please tell me what I'm doing wrong? I've copied the code for another project/query I wrote and that one doesn't give me any problems.
I'm awarding 500 points for a quick and working solution.
Thanks
Sarah
This is really annoying me! I have 2 lines which state:
ALTER TABLE ROSS_LIVE ADD Net_Amount float (20) default (0) NOT NULL;
GO
It creates the column but as a real, not a float. Could someone please tell me what I'm doing wrong? I've copied the code for another project/query I wrote and that one doesn't give me any problems.
I'm awarding 500 points for a quick and working solution.
Thanks
Sarah
Why do you say it's a real?
ASKER
Hi Vitor
I right-clicked on the table, selected Design and that's what it told me it was.
Thanks
Sarah
I right-clicked on the table, selected Design and that's what it told me it was.
Thanks
Sarah
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wow! You're right. Thanks. I changed it to 25 and it's now creating as a float. That's really weird! You don't always need a length of 25 when you create a float field.
The default is 53! :O
Anyway if you need to store money values you have money and smallmoney data types.
Anyway if you need to store money values you have money and smallmoney data types.
The ISO synonym for real is float(24).https://msdn.microsoft.com/en-AU/library/ms173773.aspx
i.e. It was already a "Float" but called a "Real" (confusing? yes, but I didn't make it that way)