usp_CheckDuplicateLicenseUserGroup.sql 1.7 KB
USE [AIADatabaseV5]
GO
/****** Object:  StoredProcedure [dbo].[usp_CheckDuplicateLicenseUserGroup]    Script Date: 24-05-2018 17:02:43 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- ====================================================  
-- Author:  Magic Software  
-- Create date: 24-May-2018  
-- Description: To check for the existence of user group with same name for a license
-- ====================================================  
ALTER PROCEDURE [dbo].[usp_CheckDuplicateLicenseUserGroup] 
	-- Add the parameters for the stored procedure here
	@LicenseId int, @Title varchar(100), @Status bit out
AS
BEGIN

	SET NOCOUNT ON;  
	set @Status = 0;  

	if(exists(select * from UserGroup where LicenseId = @LicenseId and lower(rtrim(ltrim(Title))) = lower(rtrim(ltrim(@Title)))))
	begin
		set @Status = 1;
	end
  
END