select * from memsales where caldate between @sdate and @edate AND mem_no IN (SELECT x.mem_no FROM openxml(@hDoc,'VFPData/temp') with (mem_no char(6)) x)If this doesn't help, you'll have to run your sproc from the Query Analyzer to view Execution plan. It may help you to see what slows query down.
>SET QUOTED_IDENTIFIER ON >GO >SET ANSI_NULLS ON >GO > >ALTER procedure sp_memsales_xml (@memno varchar(8000), > @sdate datetime, > @edate datetime) >as > >declare @hDoc int >execute sp_xml_preparedocument @hDoc output, @memno > >select * from memsales m > join openxml(@hDoc,'VFPData/temp') with (mem_no char(6)) x > on m.mem_no = x.mem_no > where caldate between @sdate and @edate > >execute sp_xml_removedocument @hDoc > >GO >SET QUOTED_IDENTIFIER OFF >GO >SET ANSI_NULLS ON >GO>