[AccessD] Re: How To: Create a Stored Procedure using a parameter for IN

Robert L. Stewart rl_stewart at highstream.net
Mon Feb 16 22:31:01 CST 2004


Final SQL Stored Procedure:

CREATE PROCEDURE usp_Build_In
      @Select varchar(500),
      @From varchar(150),
      @Where varchar(500),
      @In varchar(500),
      @OrderBy Varchar(250)
AS
BEGIN
      DECLARE @SQL varchar(1900)
      SET @sql = @Select + @From + @Where + @In + @Orderby
      EXEC(@sql)
END

To Use it:

SET QUOTED_IDENTIFIER OFF
GO
exec usp_Build_In 'SELECT ClientID,ResidenceType,LastName ',
                   'FROM tbl_Client ',
                   'WHERE LastName IN(',
                   "'Stewart','Jones')",
                   'ORDER BY LastName'

Notice the Double-quotes on the @In parameter.

Robert, I am still working on the idea of using the subquery.
The code you sent to me only returns one row, the last one in
the list. But I will have more time to work with it tomorrow.

RLS 





More information about the AccessD mailing list