title: Conversion failed when converting the varchar value '****' to data type int
body: <p>I am using Stored Procedure in Sql Server 2005.</p>
  
  <p>I am getting this error: </p>
  
  <blockquote>
    <p>"Conversion failed when converting the varchar value 'My_41.png' to data type int."</p>
  </blockquote>
  
  <p>imageID is declared as varchar(300)  in tbl_itemImage
  @ReturnValue is declared as varchar(MAX)</p>
  
  <p>Insert and Update Query executed well, and Data is also Stored in Table.
  But at the end when SELECT Query is executed it gives me an above error.</p>
  
  <p>This is my STORED PROCEDURE</p>
  
  <pre><code>insert into 
  tbl_itemImage(itemID,imageID,name,isCoverImage,createdBy,createdOn)
  values      
  (@itemID,@imageID,@name,@isCoverImage,@ID,getdate())  
  
  
  
  update tbl_itemImage
  set imageID =  @imageID + CAST(@@Identity as varchar(10))+ @imageExtension
  where   itemimageID = @@Identity  AND imageID &lt;&gt; '' 
  
  
  DECLARE @ReturnValue  varchar(MAX)
  
  select @ReturnValue = imageID from tbl_itemImage where itemImageID  = @@Identity 
  
  Return  @ReturnValue
  </code></pre>