views:

18

answers:

2

Hi. how can i Cast uniqueidentifier to binary in Sql? Thanks.

+5  A: 
SELECT CAST(YourColumn AS BINARY)
Ardman
+2  A: 

Basically you will need to use CAST in SQL server -

DECLARE @program_guid uniqueidentifier, @program_binary binary(16)
--
SELECT @program_guid = '327EBEA7-3D4E-473A-8D72-7CB68AB51F73'
SELECT @program_binary = CAST(@program_guid AS binary(16)) 
Sachin Shanbhag