Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
titleDelete Script
linenumberstrue
USE [iQSonarSE]
GO
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)
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

...