Performing BitWise exclusive OR(^) and NOT(~) in Sql

Bageshkumarbagi
Posted by Bageshkumarbagi under Sql Server category on | Points: 40 | Views : 673
Hi,

USE TestBackUp
GO
IF

EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'bitwise')

DROP TABLE bitwise
PRINT 'Table Allready Exit'
GO

CREATE TABLE bitwise
(
a int NOT NULL,
b int NOT NULL
)
GO
INSERT bitwise VALUES (70, 75)
GO

USE TestBackUp
GO
SELECT a ^ b As 'BitWise exclusive OR Value',
~a AS 'BitWise NOT Value'

FROM bitwise
GO


Out Put

BitWise exclusive OR Value BitWise NOT Value
13 -71

Comments or Responses

Login to post response