How numbers are stored in SQL

  • Hey I am new to this forum, hope i am posting my query at the right place.

    I am using uint datatype in c# however to save storage i am converting them into int and storing them in SQL as both uint and int are of 4 byte excepts that int can store -ve values. so any positive uint value which is over the range of int is converted as -ve value and is stored, while retrieving it i convert it into +ve uint value. Now my questing is, why the following two commands give different outputs, please help me understand.

    1. select convert(bigint,convert(binary(8),3000000001))

    2. DECLARE @i BIGINT = 3000000001

    select convert(bigint,convert(binary(8),@i))

    Thanks in advance.

    Naresh

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply