I am currently working on creation of SP to automate the process of importing flat data into SQL Server.
I want you to give me some useful advice on the best way how to realise, taking into account things I need:
Okay, now my thoughts. I would use either bcp or BULK INSERT.
Declare delimeter, source file, table as variables.
To identify column order I think we should parse first row with names and use intermediate table from which we then INSERT...SELECT into destination table in the right order.
Check if data already EXISTS before importing.
Still don't know about logging in one file with timeline. Any other errors that may occur?
Any advice would be appreciated. Thank you in advance.
asked Apr 19, 2014 at 10:59 AM in Default
Refer to this forum post on exporting logging information to a flat file http://social.msdn.microsoft.com/forums/sqlserver/en-US/40b0334e-5c44-403d-9e9f-6cdf67a8f3ff/export-to-csv-file-using-tsql-from-ssms
As suggested earlier, SSIS would be the best option suited in this scenario. Refer to this tutorial on importing flat files: http://technet.microsoft.com/en-us/library/ms169917.aspx
answered Apr 22, 2014 at 04:18 AM
You have a list of task to perform.
Please go ahead with SSIS package as performing all this in SQL Server will be bit complex. Using SSIS you can perform this and lot more with ease.
answered Apr 21, 2014 at 01:12 PM