Where-statement with parameter

Results 1 to 5 of 5

Thread: Where-statement with parameter

  1. #1
    Richard K Guest

    Default Where-statement with parameter

    I'm trying to implement a search functionality. I have a stored procedure to which the where clause is sent in via a parameter, but what should the proper syntax inside the procedure look like? I've tried something like "SELECT xxx FROM yyy WHERE @WhereClause", but it doesn't work. I get syntax errors. Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: Where-statement with parameter

    post what you have, we&#039;ll correct you.<BR><BR>j

  3. #3
    Richard K Guest

    Default RE: Where-statement with parameter

    What follows is the faulty procedure...<BR>/Richard<BR><BR>CREATE PROCEDURE sp_PagedItems<BR> (<BR> @Page int,<BR> @RecsPerPage int,<BR> @WhereClause varchar(5000)<BR> )<BR>AS<BR><BR>SELECT ARId, convert(varchar(400), ARTitle), ARPuff, ARDate FROM ARArticle <BR>WHERE ARPublished = -1 AND @WhereClause<BR>ORDER BY ARDate DESC<BR>

  4. #4
    TAP Guest

    Default RE: Where-statement with parameter

    ---calling stored procedure will be like this---<BR>sql = "sp_loginmaster @sqltype=1, @userid =&#039;" &logname & "&#039;," &" @password = &#039;" & passwd & "&#039;"<BR>---executing<BR>set rs = conn.Execute(sql)CREATE PROCEDURE <BR><BR>------stored procedure -----------<BR>sp_loginmaster <BR>(<BR>@sqltype smallint,<BR>@userid varchar(10)=null,<BR>@password varchar(10)=null<BR><BR>)<BR>AS<BR><BR>if @sqltype =1 <BR> select * from login_master where userid = @userid and password=@password<BR><BR>

  5. #5
    Richard K Guest

    Default RE: Where-statement with parameter

    Yes, normally it would. But I&#039;m trying to send in "userid = @userid" as a parameter, to make the whole thing a tad more flexible...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts