﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[fds__fn_getMFRInvoicesWithoutfiles]
	
AS
BEGIN
	SET NOCOUNT ON;

    select TOP(0) [id],i.[URI],i.[DocumentName] from mfr__invoices as i where not exists (SELECT 0 FROM [dbo].[fds__mfr_invoicefiles] as f where f.[Id] = i.[id]) AND i.[documentname] like '%.pdf'
		ORDER by (SELECT TOP(1) [rn] FROM [dbo].[ocms_fn_rand]);
END