MS SQL Stored Procedure to validate and import CSV data into table
Posted on 2013-06-11
I need to write a SQL Stored Procedure, that does the following ..
Using Server.MapPath (ASP) selects a file that has been uploaded to the server.
Validates that the files is a CSV format.
Validates that the columns are correct (Column Headings) and as expected - name / col2 / col3 etc
Imports the data into a table.
If the file is not a CSV format and error code should be returned.
If the column headers are not correct, an error code should be returned.
That's the basis of the SP, probably the most complicated part (and the part that I would appreciate assistance with please)
It does other stuff too, like archiving the historic data, but I think I can cope with the additional stuff.
I would appreciate some help with the above though please.
FYI, my application is a classic ASP VBScript app.