I have a SQL Server table which contains a column userid
of type uniqueidentifier
and the column value is 9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7E
.
When I'm querying like this:
WHERE userid = '9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7E'
The query is running successfully. If I add extra characters at the end of the string it is also working fine like below
WHERE userid = '9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7Eqweqweqwemmmmmmmmmm'
But the problem is when I'm adding extra characters at the start of the string the query is showing error.
WHERE userid = 'A9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7E'
The error showing like
Conversion failed when converting from a character string to uniqueidentifier
My question is why the error is showing for only adding character at the start of the string and how to track this error inside a stored procedure