There are 2 ways to Convert a string to a UniqueIdentifier (GUID) in SQL Server:
SELECT CAST(‘449141d9-86c9-449d-be2c-1f171b4f4567’ as UNIQUEIDENTIFIER)
SELECT CONVERT(UNIQUEIDENTIFIER, ‘449141d9-86c9-449d-be2c-1f171b4f4567’)
thanks dude – you saved my bacon!
Hi, I have a question.
Want to know which one will perform better when converting varchar to uniqueidentifier OR nvarchar to uniqueidentifier? Thanks in advance!
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
© 2022 Software Engineer and UX Designer.
Built with ❤️ using WordPress and Ketos Theme.