0

We have a locally hosted third-party SQL Server ERP database I've been working with for a while.

For one of our KPI reports we need historical data. This data is not generated by the ERP database anywhere.

Right now we're storing the date sequences loosely in a plain-text 'notes' field in each affected item, but this is problematic for many reasons, some of which I'm sure you can imagine right away.

I'd like to store this data properly, in a table. One option is to create a table in our Access DB, but doing so is turning into a convoluted mess that's only making, and going to make, things more difficult.

So my question is this: can I directly add a table to this ERP database safely, maintaining new additions with a trigger, or will there be some kind of garbage collection/maintenance routine generally found on databases that would make this unsafe to do? I have very little database admin. experience, so I have no idea about any gotcha's or anything else that might be an issue if I did this.

Thanks very much

2
  • 2
    Contact your EFP vendor. Some vendors do not permit creating objects as it may impact their upgrade installation process.
    – Dan Guzman
    Commented Oct 19, 2023 at 16:37
  • Yeah this is probably the one thing I should have expected to hear. I'm sure you're right. Thanks for the response. I suppose the reason I asked is because I imagine it's in their business's best interest to lock things down and prevent this kind of customization. I'm just worried this will be less likely to happen if they're aware of it. Anyway, thanks again.
    – fjdksflds
    Commented Oct 19, 2023 at 17:07

1 Answer 1

2

can I directly add a table to this ERP database safely, maintaining new additions with a trigger, or will there be some kind of garbage collection/maintenance routine generally found on databases that would make this unsafe to do?

Firstly, I agree with Dan, that it's usually best to be in communication with the Vendor on what they're ok with in regards to changes you can make. Some are more flexible than others and can proactively advise you on what to avoid. Typically the kind of issues you run into is from compatibility problems between the software and the changes you make, or the upgrade process the vendor follows. If you make an incompatible change, the vendor is likely going to find out when you call them for support one way or the other anyway.

Secondly, it's always best to be as least invasive as possible, even with the vendor's permission. There's no guarantee that the objects you create or the changes you make in the vendor database will always be left untouched by the vendor application and / or upgrade process - even if the vendor tells you it's ok.

So with that said, an ideal solution would be to have a process that copies the data you care about outside of the vendor database and into your own database. This secondary database will be decoupled from the vendor's database and theoretically the vendor shouldn't have access to it (e.g. during upgrades). Then you don't have to be as concerned about the changes you make in that secondary database.

There are a couple ways you could do this, in order from least invasive to most:

  1. Write a separate application / script that is scheduled and does bulk loading of the data at specific intervals. The downside is the data won't be synchronized real-time, if that's a requirement.

  2. Use a native SQL Server data synchronization feature to copy the data to a separate database. Some of the available features are: Replication, AlwaysOn Availability Groups, and SSIS. The pros are they can mostly be used for real-time data synchronization, and as a more out-of-the box solution have less code to maintain. They each have their own limitations and aren't always the easiest thing to setup though.

  3. Triggers - You can use triggers to copy data into other databases too. But now this enters the realm of invasiveness of creating objects in the vendor database. There's no guarantee that your triggers will always exist.

Once the data is migrated to your own database, you'll have full control on how you maintain the historical data. There's even out-of-box solutions SQL Server offers for maintaining table history for you, including Temporal Tables or Change Data Capture.

1
  • 1
    Awesome, thanks for the detailed response. I'll start looking into these!
    – fjdksflds
    Commented Oct 19, 2023 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.