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)

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

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!