Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Create table from csv dynamically

Author  Topic 

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2012-07-04 : 02:31:28
We have a number of csv files which arrive on our doorstep regularly which we then have to manually import into the database using the import wizard.

Is there a way of dynamically importing a csv so the table is created automatically on import?
This would save a lot of time using the import wizard.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-07-04 : 04:02:56
Import into a single column table (bcp) then parse the first row and create a table from it then import.


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2012-07-04 : 05:59:11
Thanks, Doh! shouldav thought of that.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-04 : 19:02:13
see

http://www.codeproject.com/script/Articles/ListVersions.aspx?aid=301542

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -