title: Convert from UniqueIdentifier to BigInt and Back?
body: <pre><code>declare @uu uniqueidentifier =  'C50B0567-F8CC-4219-A1E1-91C97BD9AE1B'
  select @uu
  declare @zaza bigint = ( select convert(bigint, convert (varbinary(8), @uu, 1)) )
  select @zaza
  select CONVERT( uniqueidentifier , convert( varbinary(16) , @zaza , 1 ) )
  </code></pre>
  
  <p>I thought I had a fast way to convert Unique Identifier values to a Big Int, and back. But there is a problem in my second convert. Can anyone comment on the right way to fully convert a GUID to a number and back? I am only getting part of the GUID and not the whole thing when I try to convert it back from the numeric representation to its original GUID.</p>
  
  <p>I want to pass an integer (I think it would be classified as a "Large BigInt" in MSSQL?) to a remote system and just use characters 0-9, and still get the random uniqueness of NewId().</p>