USE [AIADatabaseV5] GO /****** Object: StoredProcedure [dbo].[GetLicenseIdByUserId] Script Date: 02/06/2018 10:49:32 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON 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