How to load the data from CSV file in temp table at run time? RRS feed

  • Question

  • Hi - 

    I want to know how I can load the CSV file data into the sql server table. I know there are ways like bulk insert and other to load the csv file data into the table. But in my case the table doesn't exist and has to be created at the run time. 

    With simple insert in temp table we do like 

    select * into #temp from tablename

    and that creates the temp table. So. I need something like that which create the temp table and load the data into it. because the CSV file would have different number of columns and names so I can not create the table structure in advance. I have to create the table at run time. 

    Please let me know how I can do this. 


    Thursday, May 28, 2015 2:01 PM


All replies