title: BULK INSERT with inconsistent number of columns
body: <p>I am trying to load a large amount data in SQL server from a flat file using BULK INSERT. However, my file has varying number of columns, for instance the first row contains 14 and the second contains 4. That is OK, I just want to make a table with the max number of columns and load the file into it with NULLs for the missing columns. I can play with it from that point. But it seems that SQL Server, when reaching the end of the line and having more columns to fill for that same row in the destination table, just moves on to the next line and attempts to put the data on that line to the wrong column of the table.</p>
  
  <p>Is there a way to get the behavior that I am looking for? Is there an option that I can use to specify this? Has anyone run into this before?</p>
  
  <p>Here is the code</p>
  
  <pre><code>BULK INSERT #t
  FROM '&lt;path to file&gt;'
  WITH 
  (
    DATAFILETYPE = 'char',
    KEEPNULLS,
    FIELDTERMINATOR = '#'
  )
  </code></pre>