title: Conversion failed when converting the nvarchar value 'INSERT into dbo
body: <p>I know this question might be repeated. I have checked my query more than 2 times but I don't know what is the problem?</p>
  
  <p>Here is my stored procedure with cursor:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[SPApprove_Request](@Id int, @NumRowsChanged int OUTPUT)
  AS
  BEGIN TRAN ApprovalTransaction
  
  DECLARE @Mapping_Id int, @C_Id int, @Service_Table varchar(50), @Ser_Id int, @sql nvarchar(4000), @Today_Date datetime
  
      SET @Today_Date=GETDATE()
  
      DECLARE cursorObj CURSOR LOCAL static FOR SELECT serType.Service_Table_Name, serMap.Id, serMap.Request_Id FROM [Service_Type] as serType, [Service_Mapping] as serMap WHERE serType.Id = serMap.Service_Type_Id AND serType.Id IN (SELECT Service_Type_Id FROM Service_Mapping WHERE Request_Id = @Id) and serMap.Request_Id=@Id
  
      OPEN cursorObj
      --SELECT @@CURSOR_ROWS AS TotalRows
      FETCH NEXT FROM cursorObj into @Service_Table, @Mapping_Id, @C_Id
      WHILE @@FETCH_STATUS = 0
      BEGIN
          SET @sql = 'INSERT into dbo.' + quotename(@Service_Table) + '(Request_Id, Is_Active, Is_Deleted, Is_Cancelled, Created_Date) VALUES (' + @C_Id + ',1, 0, 0,'''+ convert(VARCHAR,@Today_Date) +''')'
          EXEC sp_executesql @sql
          SELECT @Ser_Id = @@IDENTITY
          IF (@@ERROR &lt;&gt; 0) GOTO ERR_HANDLER
          UPDATE [Service_Mapping] SET Service_Id = @Ser_Id WHERE Id = @Mapping_Id
          FETCH NEXT FROM cursorObj into @Service_Table, @Mapping_Id, @C_Id
      END
      CLOSE cursorObj
      DEALLOCATE cursorObj
      UPDATE [Request] SET State_Id = 2, Service_State_Id = 1, Approve_Disapprove_Date = @Today_Date, Date_Modified = @Today_Date WHERE Id = @Id
      SELECT @NumRowsChanged = @@ROWCOUNT
  COMMIT TRAN ApprovalTransaction
  RETURN @NumRowsChanged  
  
  ERR_HANDLER:
  PRINT 'Unexpected error occurred while Approving CRM Request!'
  ROLLBACK TRAN ApprovalTransaction
  </code></pre>
  
  <p>Getting error:</p>
  
  <blockquote>
    <p><em>Msg 245, Level 16, State 1, Procedure SPApprove_CRM_Doctor_Request,
    Line 19<br>
    Conversion failed when converting the nvarchar value 'INSERT
    into dbo.[Financial_Assistance](CRM_Doctor_Request_Id, Is_Active,
    Is_Deleted, Is_Cancelled, Created_Date) VALUES (' to data type int.</em></p>
  </blockquote>