Search code examples
sql-servertriggersazure-sql-databasedbmigrate

What to do with triggers on SQL Server database during migration to Azure DB?


I have a SQL Server database to be migrated to Azure.

Can I replace triggers with something else on Azure? Service?

Or is the only option to remove the triggers and redesign their logic?

Thanks.


Solution

  • It sounds like what your are looking for are options to occasionally run logic in Azure. By this, I'm assuming that your triggers logic doesn't have to be run right after a db call is made. This means you'll first need the following:

    1. Some way to tell if the 'create' trigger logic should be processed
    2. Some way to tell if the 'delete' trigger logic should be processed

    If you can do this with queries on your data without changing/rewriting your logic (as requested) then you have a few options to get that logic run.

    Option 1 WebJob - if you already have a WebApp, you can create a scheduled webjob to run ever so often to check if the create/delete trigger logic needs run and then run that sql in another manner besides a trigger.

    Option 2 Automation Runbook - if you don't currently have a site or compute running in Azure, then you can use an Automation Runbook to do the checking for the create/delete trigger logic and do what needs done.

    Option 3 WorkerRole or VM - if you already have a WorkerRole or VM running in Azure, you could just add the trigger checking logic to be run using the machine's taskscheduler.