convert guid to varchar sql code example Example: convert sql server guid to varbinary select cast(hashbytes('md5','foo') as uniqueidentifier)