Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - SQL Server Numbers
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SQL Server Numbers

 Post Reply Post Reply
Author
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Topic: SQL Server Numbers
    Posted: 07 April 2005 at 12:48pm
Hi

I want to store numbers in my SQL Server database, how high can Int go?  Can you set an int to be unsigned as I only need to to be whole integers from 0 onwards.

I'm looking to store numbers anywhere from zero into the trillions.  I don't want to store it as a string and write my own add functions etc!  Numbers have to be accurate.

Thanks,

Tom
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 12:56pm
I don't think you can have unsigned integers the max field size for int is 12 so I assume the biggest number you can have is 999,999,999,999 not cetain though

EDIT: I think its 999,999,999 actually, as that is the highest value I can insert



Edited by Mart - 07 April 2005 at 1:05pm
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 1:12pm
Rats that's only 1 billion.  I really need a lot more than that.  Is the only way to get past this to store it as a string and write my own functions to do math on them?  That's going to be a royal pain in the ass.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 1:54pm
Int can hold a max of 2,147,483,647
BigInt can hold a max of 9,223,372,036,854,775,807
If you need to go higher, you approximate numbers like 'real' and 'float' which go to 3.40E + 38 respectively 1.79E + 308
 
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 1:59pm
Thanks

I get mismatches when dealing with the bigints in ASP, what do I convert the bigint value from the database to?  Long?  Or is that not big enough.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 2:14pm
no idea. asp too long ago. sorry
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 4:57pm
You get errors if you try to do Integer math or BigInts via VBScript. IF you convert them to doubles via VBScript, then you should not have that problem.
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2005 at 8:07pm
Isn't double inaccurate though?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.