cross posted on https://www.helpmij.nl/forum/showthr...-Server-ACCESS
My answer: create a stored procedure or table-valued function on SQL server. I prefer working with stored procedures because they offer more possibilities.
Example stored proc:
Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: NGA
-- Create date: 2022-08-13
-- Description: Demo
-- =============================================
CREATE PROCEDURE p_getDataDemo
@pTag varchar(50) = '',
@pDone bit = 0
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM vw_Produktregistraties WHERE [TAG] like '%' + @pTag + '%' and [Done] = @pDone
END
GO
In your example you first get all data over the network and then filter it. That is the slow way of doing so. Check your view for indexes that might help. For the query above a (filtered) index on the field [Done] might help. You could execute the query (procedure) in the SSMS with execution plan and then check the execution plan for further query improvements.