title: Use first row of CSV file as column name SQL
body: <p>I am using Microsoft SQL Server Management studio and I am currently importing some CSV files in a database. I am importing the CSV files using the BULK INSERT command into already existing tables, using the following query. </p>
  
  <pre><code>BULK INSERT  myTable
      FROM &gt;&gt;'D:\myfolder\file.csv'
      WITH
      (FIRSTROW = 2,
      FIELDTERMINATOR = ';', --CSV Field Delimiter
      ROWTERMINATOR = '\n', -- Used to shift to the next row
      ERRORFILE = 'D:\myfolder\Error Files\myErrrorFile.csv',
      TABLOCK
      )
  </code></pre>
  
  <p>This works fine for me thus far, but I would like to automate the process of naming columns in tables. More specifically I would like to create a table and use as column names, the contents of the first row of the CSV file. Is that possible?</p>