if exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DMX_Log_{objectQualifier}DMX_Users') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE {databaseOwner}{objectQualifier}DMX_Log
  DROP CONSTRAINT FK_{objectQualifier}DMX_Log_{objectQualifier}DMX_Users
GO

if not exists (select * from dbo.sysobjects where id = object_id(N'FK_{objectQualifier}DMX_Log_{objectQualifier}Users') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE {databaseOwner}{objectQualifier}DMX_Log ADD CONSTRAINT
	FK_{objectQualifier}DMX_Log_{objectQualifier}Users FOREIGN KEY
	(
    UserId
	) REFERENCES {databaseOwner}{objectQualifier}Users
	(
    UserID
	) ON DELETE CASCADE
	 NOT FOR REPLICATION

GO

