20 August 2013

Update alternate rows in sqlserver

update s set recstatus=’I’ from
(select row_number() over (order by id) sno,* from mastertbl)s
where sno%2=0

or

with c as (
select row_number() over (order by id) sno,* from mastertbl
) update c set recstatus=’I’ where sno%2=0

02 August 2013

Int range in .net

Int16 : The value of this constant is 32767 : hexadecimal 0x7FFF

Int16 (or short) uses 16 bits to store a value, giving it a range from -32,768 to 32,767

Int32 uses 32 bits to store a value, giving it a range from -2,147,483,648 to 2,147,483,647

Int 64 -- (-9223372036854775808 to +9223372036854775807)
SByte Min: -128 Max: 127
Byte Min: 0 Max: 255
Int16 Min: -32768 Max: 32767
Int32 Min: -2147483648 Max: 2147483647
Int64 Min: -9223372036854775808 Max: 9223372036854775807
Single Min: -3.402823E+38 Max: 3.402823E+38
Double Min: -1.79769313486232E+308 Max: 1.79769313486232E+308
Decimal Min: -79228162514264337593543950335 Max: 79228162514264337593543950335