title: How to validate a CSV file before importing into the database using SSIS?
body: <p>I have CSV file with three columns.</p>
  
  <pre><code>sno  sname  quantity
  ---  -----  --------
   1   aaa    23
   2   bbb    null
   3   ccc    34
   4   ddd    ddd
   5   eee    xxx
   6   fff    87
  </code></pre>
  
  <p>Table in the SQL Server database is as following/ </p>
  
  <pre><code>CREATE TABLE csvtable
  (       sno         int
      ,   sname       varchar(100)
      ,   quantity    numeric(5,2)
  )
  </code></pre>
  
  <p>I created an SSIS package to import csv file data into the database table. I am getting an error during package execution because the quantity is a string. I created another table to store the invalid data. </p>
  
  <pre><code>CREATE TABLE wrongcsvtable
  (       sno         nvarchar(10)
      ,   sname       nvarchar(100)
      ,   quantity    nvarchar(100)
  )
  </code></pre>
  
  <p>In the <em>csvtable</em>, I would like to store the following data.</p>
  
  <pre><code>sno  sanme   quantity
  ---  ------  --------
   1   aaa     23
   3   ccc     34
   6   fff     87
  </code></pre>
  
  <p>In the <em>wrongcsvtable</em>, I would like to store the following data.</p>
  
  <pre><code>sno  sanme   quantity
  ---  ------  --------
   2   bbb     null
   4   ddd     ddd
   5   eee     xxx
  </code></pre>
  
  <p>Could someone point me in the right direction to achieve the above mentioned output?</p>