Курсовая работа: Контроль и учет технического состояния магистральных трубопроводов транспортирующих огнеопасные продукты

Рис. 2.

2.3 Хранимые процедуры

Хранимая процедура для удаления записи из таблицы «Трубопроводы»:

CREATE PROCEDURE spDelPipeline(@Id uniqueidentifier) AS

DELETE FROM CommentaryPipeline

WHERE Id_Pipeline = @id

DELETE FROM InspectionPipeline

WHERE Id_Pipeline = @id

Delete from RevisionPartsPipeline where

RevisionPartsPipeline.id_RevisionPartsPipeline in

(select RevisionPartsPipeline.id_RevisionPartsPipeline from

((Pipeline inner join PartsPipeline on Pipeline.id_Pipeline = PartsPipeline.id_Pipeline) inner join

RevisionPartsPipeline on PartsPipeline.id_PartsPipeline = RevisionPartsPipeline.id_PartsPipeline)

where Pipeline.id_Pipeline=@id)

Delete from TestPartsPipeline where

TestPartsPipeline.id_TestPartsPipeline in

(select TestPartsPipeline.id_TestPartsPipeline from

((Pipeline inner join PartsPipeline on Pipeline.id_Pipeline = PartsPipeline.id_Pipeline) inner join

TestPartsPipeline on PartsPipeline.id_PartsPipeline = TestPartsPipeline.id_PartsPipeline)

where Pipeline.id_Pipeline=@id)

Delete from RefusalPartsPipeline where

RefusalPartsPipeline.id_RefusalPartsPipeline in

(select RefusalPartsPipeline.id_RefusalPartsPipeline from

((Pipeline inner join PartsPipeline on Pipeline.id_Pipeline = PartsPipeline.id_Pipeline) inner join

RefusalPartsPipeline on PartsPipeline.id_PartsPipeline = RefusalPartsPipeline.id_PartsPipeline)

where Pipeline.id_Pipeline=@id)

Delete from DiagnosticPartsPipeline where

DiagnosticPartsPipeline.id_DiagnosticPartsPipeline in

(select DiagnosticPartsPipeline.id_DiagnosticPartsPipeline from

К-во Просмотров: 267
Бесплатно скачать Курсовая работа: Контроль и учет технического состояния магистральных трубопроводов транспортирующих огнеопасные продукты