USE [iQSonarSE]
GO
/****** Object: StoredProcedure [jobs].[Job_Create] Script Date: 15.03.2017 13:19:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [model].[deleteServer]
@ServerID INT
AS
BEGIN
SET NOCOUNT ON;
SET XACT_ABORT ON;
-- delete server
update jobs.t_Job set ServerID =(select max(ServerID) from config.t_Server where ServerID !=@serverId)
update config.t__Location_Server set ServerID =(select max(ServerID) from config.t_Server where ServerID !=@serverId)
delete from config.t_ServerMetric where ServerID=@serverId
delete from config.t_LinkedConnectionConfigurationPort where LinkedConnectionConfigurationID in(select LinkedConnectionConfigurationID from config.t_LinkedConnectionConfiguration where ServerID =@serverId)
delete from config.t_LinkedConnectionConfigurationOption where LinkedConnectionConfigurationID in(select LinkedConnectionConfigurationID from config.t_LinkedConnectionConfiguration where ServerID =@serverId)
-- 2018-09-10 GSE Added these 2 line for Gywnn R3
delete from config.t_LinkedProductAdapterConfigurationOption where LinkedProductAdapterConfigurationID in ( select LinkedProductAdapterConfigurationID from config.t_LinkedProductAdapterConfiguration where ServerID =@serverId)
delete from config.t_LinkedProductAdapterConfiguration where ServerID =@serverId)
delete from config.t__Server_ProductAdapterConfiguration where ServerID =@serverId
delete from config.t_LinkedConnectionConfiguration where ServerID =@serverId
delete from config.t_Server where ServerID =@serverId
END |