ALTER PROCEDURE [dbo].[Get_OUAufsatz]
@InternalOUID uniqueidentifier
,@asOfDate as datetime = null
AS
BEGIN
SET NOCOUNT ON;
IF @asOfDate is null
SET @asOfDate = getdate()
SELECT [AufsatzId]
,[H_ValidSince]
,[H_ValidUntil]
,[H_UID]
,[InternalOUId]
,[Test1]
,[Test2]
FROM [dbo].[OUAufsatz]
WHERE
[InternalOUId] = @InternalOUID
AND @asOfDate BETWEEN [dbo].[OUAufsatz].[H_ValidSince]
AND [dbo].[OUAufsatz].[H_ValidUntil]
|