dbo.GetLicenseIdByUserId.StoredProcedure.sql 1.3 KB
USE [AIADatabaseV5]
GO
/****** Object:  StoredProcedure [dbo].[GetLicenseIdByUserId]    Script Date: 2/1/2018 12:15:55 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GetLicenseIdByUserId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[GetLicenseIdByUserId]
GO


CREATE PROCEDURE [dbo].[GetLicenseIdByUserId]
(
	@iUserId int
)
AS
	SET NOCOUNT ON;
SELECT LicenseId FROM LicenseToEdition
INNER JOIN AIAUserToLicenseEdition on AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id
WHERE  AIAUserToLicenseEdition.UserId = @iUserId
GO