Conversion failed error is showing for uniqueidentifier in SQL query
<p>I have a SQL Server table which contains a column <code>userid</code> of type <code>uniqueidentifier</code> and the column value is <code>9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7E</code>.</p>

<p>When I'm querying like this:</p>

<pre><code> WHERE userid = '9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7E'
</code></pre>

<p>The query is running successfully. If I add extra characters at the end of the string it is also working fine like below</p>

<pre><code>WHERE userid = '9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7Eqweqweqwemmmmmmmmmm'
</code></pre>

<p>But the problem is when I'm adding extra characters at the start of the string the query is showing error.</p>

<pre><code>WHERE userid = 'A9EBC02CE-FA3A-4A62-A3B7-B9B6CFD33B7E'
</code></pre>

<p>The error showing like </p>

<blockquote>
  <p>Conversion failed when converting from a character string to uniqueidentifier</p>
</blockquote>

<p>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</p>