Search code examples
sql-serversqldatatypestype-conversion

Why is this data type conversion failing but not failing?


Ok, so I'm wracking my brain on this one...

These two queries... though they appear the same... are apparently different in some fashion. When run against a database in SQL Server Management Studio the top one results in an error (Conversion failed when converting from a character string to uniqueidentifier.) where as the bottom one runs just fine. Any ideas as to why that would be?

SELECT CONVERT(UNIQUEIDENTIFIER,'459B621C-A49A-49Cl-900F-AB14D61841E2');
SELECT CONVERT(UNIQUEIDENTIFIER,'459B621C-A49A-49C1-900F-AB14D61841E2');

Could it be a character encoding issue?

Thanks


Solution

  • There is a difference. The first one uses an l, the second is 1.