I want to find maximum number in sql server i have values with string part and integer part
<p>I have values like <code>SP-1</code>,<code>SP-2</code>,<code>SP-3</code>.....<code>SP-10</code>,<code>SP-11</code>.</p>

<p>I have to get the maximum number from here in my SQL server </p>

<pre><code>SELECT MAX(SUBSTRING(SupplementId,4,10)) AS max_num FROM supreg
</code></pre>

<p>When I execute the code I get the maximum number as 9.</p>