Thursday, 15 September 2011

sql server - SQL concatenate two smaller datatypes into one larger datatype -


How can I add two small datasets to a large datatype?

TinyInt (1) = 17 = 0001 0001

TinyInt (2) = 5 = 0000 0101

New small entrant = tinient (1) + tinist (2 ) = 4357 = 0001 0001 0000 0101

I am trying to do this on a MSSQL server 2008 through a stored procedure. After that the larger value will be deposited in the table.

You can pipe using the power function and then make a bitword or (|).

  Declare @x tint announced @y tinyint set @ x = 17 set @ y = 5 declare @z small set @z = @x * power (2, 8). @ Select @z  

No comments:

Post a Comment