-- ProductionDataBaseSync: dedicated schema that groups every object owned by -- the Access -> SQL Server sync (SyncQueue staging, SyncLogArchive audit store, -- and the usp_SyncApply procedure). Keeping them out of dbo makes ownership and -- housekeeping explicit. -- Idempotent: CREATE SCHEMA must be the only statement in its batch, so it is -- wrapped in EXEC() behind an existence check. IF NOT EXISTS (SELECT 1 FROM sys.schemas WHERE name = 'ProductionDataBaseSync') BEGIN EXEC('CREATE SCHEMA ProductionDataBaseSync'); END GO