title: How to return string value from the stored procedure
body: <pre><code>Alter procedure S_Comp(@str1 varchar(20),@r varchar(100) out)
  as
  declare  @str2 varchar(100)
  set @str2  ='welcome to sql server. Sql server is a product of Microsoft'
  if(PATINDEX('%'+@str1 +'%',@str2)&gt;0)
      return @str1+'present in the string'
  else 
      return @str1+'not present'
  </code></pre>
  
  <p>I am executing the above stored procedure. I am getting the following error :</p>
  
  <blockquote>
    <p>Msg 245, Level 16, State 1, Procedure S_Comp, Line 8 Conversion failed
    when converting the varchar value 'Amruthanot present' to data type
    int.</p>
  </blockquote>
  
  <p>Please do help me resolving this</p>