SQL Server Bigint Max Value

The maximum value for an Bigint in SQL Server is:

-9223372036854775808 through 9223372036854775807

And the byte size is 8 bytes.

Here is the proof (Thanks to BJ)

[cc lang=”sql”]
DECLARE @max bigint, @min bigint

SELECT @max = 127, @min = 1

WHILE @min = 1 BEGIN
BEGIN TRY
SELECT @max = @max * 2 + 1
END TRY
BEGIN CATCH
BEGIN TRY
SET @min = -1 – @max
END TRY
BEGIN CATCH

SET @min = 0

END CATCH
END CATCH
END

SELECT @min , @max
[/cc]

other maximum values:

  • Int: -2147483648 through 2147483647 (4 bytes)
  • SmallInt: -32768 through 32767 (2 bytes)
  • TinyInt: 0 through 255 (1 byte)

6 comments
unknow 18 Apr 2013 at 9:50 pm

Thanks for clear information.

Prashant Bhopale 30 Jan 2012 at 9:24 pm

Thanks for your detail information.

Will 05 Jan 2012 at 8:05 am

Can’t find the +1 to click on it?

amir 04 Nov 2011 at 1:43 am

thank u for you information 😉

Angel 13 Jul 2013 at 4:38 am
Praveen Yadav 27 Jan 2011 at 2:41 am

Yeah thats great.

Featured Articles

 Site Author

  • Thanks for visiting!
css.php