title: Got error while inserting Dataset into a database Table
body: <p>This is the error  </p>
  
  <blockquote>
    <p>String or binary data would be truncated.</p>
  </blockquote>
  
  <p>The data for table-valued parameter "@tblCustomers" doesn't conform to the table type of the parameter. SQL Server error is: </p>
  
  <blockquote>
    <p>Msg 8152, state: 10<br>
    The statement has been terminated.</p>
  </blockquote>
  
  <p>Here is the user-defined table type</p>
  
  <pre><code>CREATE TYPE [dbo].[recType] AS TABLE
  (
     [refid] [int] NULL,
     [fromid] [varchar](13) NULL,
     [toid] [varchar](13) NULL,
     [message] [int] NULL,
     [status] [varchar](13) NULL,
  )
  </code></pre>
  
  <p>Here is the stored procedure</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[SP_INSERT_RECVSMS]
      @tblCustomers recType READONLY
  AS
  BEGIN
      SET NOCOUNT ON;
  
      INSERT INTO RecieveSMS(Refid, fromID, Toid, message, status)
          SELECT 
              refid, fromid, toid, message, status 
          FROM @tblCustomers
  END
  </code></pre>