Ad
CSV (or Sheet In XLS) To SQL Create (and Insert) Statements With .Net?
Does anyone have a technique for generating SQL table create (and data insert) commands pragmatically from a CSV (or sheet in a .xls) file?
I've got a third party database system which I'd like to populate with data from a csv file (or sheet in a xls file) but the importer supplied can't create the table structure automatically as it does the import. My csv file has lots of tables with lots of columns so I'd like to automate the table creation process as well as the data importing if possible but I'm unsure about how to go about generating the create statement...
Ad
Answer
In SQL server it is as easy as
SELECT * INTO NewTablenNmeHere
FROM OPENROWSET( 'Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\testing.xls','SELECT * FROM [Sheet1$]')
Ad
source: stackoverflow.com
Related Questions
- → Function Undefined in Axios promise
- → React formatting dates with momentjs server side
- → Using ReactJs, How do I update my form fields when my parent object sent in from props changes?
- → Visual Studio 2012 Express: Browser returning 500 status trying to download jsx file
- → AngularJS directive: "templateUrl" doesn't work while "template" works
- → how to add cannonical tag for ASPX .NET page
- → Javascript Paypal slider string suffix
- → JavaScript in MVC 5 not being read?
- → Selecting an element by its attribute when it has a colon in its name
- → Function works for NON dynamically loaded images
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → There are "gaps" between rows in my masonry cards
- → creating sef links and changing plus sign (+) with dash (-)
Ad