bugnet_relatedbug_createnewrelatedbug.sql

来自「BugNET is an issue tracking and project 」· SQL 代码 · 共 28 行

SQL
28
字号
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BugNet_RelatedBug_CreateNewRelatedBug]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[BugNet_RelatedBug_CreateNewRelatedBug]
GO

CREATE PROCEDURE BugNet_RelatedBug_CreateNewRelatedBug 
	@PrimaryBugId Int,
	@SecondaryBugId Int,
	@RelationType Int
AS
IF NOT EXISTS(SELECT PrimaryBugId FROM RelatedBug WHERE (PrimaryBugId = @PrimaryBugId OR PrimaryBugId = @SecondaryBugId) AND (SecondaryBugId = @SecondaryBugId OR SecondaryBugId = @PrimaryBugId) AND RelationType = @RelationType)
BEGIN
	INSERT RelatedBug
	(
		primaryBugId,
		secondaryBugId,
		relationType
	)
	VALUES
	(
		@SecondaryBugId,
		@PrimaryBugId,
		@RelationType
	)
END

GO

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?