Constant Database Commands erroring out

I've tried to set up source control on a database server where I only have access to a subset of databases. Since then, the SQL profiler has been alerting (only when I connect to that database server) of all the commands that error out. The commands are:
USE [RedGate]

IF OBJECT_ID('[SQLSourceControl].[LockedObjects]') IS NOT NULL
    SELECT CAST(1 AS BIT)
ELSE
    SELECT CAST(0 AS BIT)

and this really long one...
-- Returns a table of the latest changes to all database objects
-- that have changed since the last time the procedure was called.
-- It compares the current version of the database objects with the
-- previous one and lists what has altered and who did it. In order
-- to work out who did it, it uses the default trace.
CREATE PROCEDURE dbo.RG_WhatsChanged_v4
  @SinceWhen DATETIME OUTPUT,
  @DatabaseList XML,
  @UseDefaultTraceRollover INT
AS
SET NOCOUNT ON
SET ANSI_PADDING ON
DECLARE
  @Ii                        INT,
  @IiMax                     INT,
  @SqlServerVersion          INT,
  @CurrentDatabase           NVARCHAR(258),
  @Command                   NVARCHAR(4000)

IF OBJECT_ID( N'tempdb.dbo.RG_AllObjects_v4', N'U' ) IS NULL
BEGIN

.....

How would one stop these commands from firing when logged onto this specific Database Server?
Tagged:

Comments

  • Andrea_AngellaAndrea_Angella Posts: 67 Silver 4
    edited July 15, 2017 7:37PM
    For the first query

    I believe this is a bug on our parts. We should check for the existence of the [Redgate] database before running that query.

    As a workaround, you can fix the alerting problem by enabling object locking on the server or if you don't need object locking by just creating an empty Redgate database on the server you are connecting to.

    For the second query

    You can disable "Indicate changed objects" in the Global Options. Unfortunately it is not possible to make this change only for a specific database server but can enable/disable this option as many times as you need. Remember that you need to restart SSMS in order to apply the changes.

    For SQL Source Control up to version 5.7 you can find the option in the Setup Page.

    y2n5ctidw2nc.png

    For SQL Source Control 5.8+ you can configure Global Options by clicking on "Options" in the top right corner (toolbar).
    Andrea Angella
    Lead Software Engineer | Red Gate
    Website: www.productivecsharp.com
    Twitter: @angella_andrea
Sign In or Register to comment.