• jasona.work - Tuesday, February 6, 2018 6:16 AM

    Sounds like a job for an SSIS package, rather than a stored procedure.
    (Please note, I'm not an SSIS developer, but I've got developers who do similar workloads of importing data)

    As for the 0 step, why remove the prior tables?  I'm presuming that indicates you drop them?  Why not simply truncate the tables, which would keep the table structures (columns, etc,) reset any ID values, and save some log thrashing?  Or, do the headers in the files you're importing change from month-to-month?

    JasonA -

    I'm not quite there yet on my skillset.  I have tested a few SSIS import packages (for other purposes) but they stopped working after our IT department reimaged my workstation.  The difficulty I had with my previous SSIS packages is that our SQL 2016 server is remotely hosted at Microsoft's Azure site.  I cannot get our IT vendor to budge on setting up a VPN tunnel to Azure and joining our SQL Server to our local domain.  So I have no AD authentication.  It's extremely irritating at times to have to do everything with SQL Authentication, but I digress...

    I had been removing the previous tables just because it was easier and I am, again, just not there yet with my skillset.  I'm able to produce the results needed for our team on a daily basis, but the time to learn is not always there and usually just on getting done what I need done quickly.  I'll get there, it's probably going to take years. 🙂  But in theory the headers on the source tables should be consistent each month, but one vendor did alert us that there were some changes coming up later this year.

    -Mark
    MSSQL 2019 Standard, Azure Hosted. Techie/Sysadmin by trade; Three years as a "DBA" now.