Passing values to a SQL 6.5 Stored Procedure

Results 1 to 2 of 2

Thread: Passing values to a SQL 6.5 Stored Procedure

  1. #1
    Join Date
    Dec 1969
    Posts
    940

    Default Passing values to a SQL 6.5 Stored Procedure

    My question is simple. Can I write a stored procedure in SQL 6.5 and pass criteria to it? Like this:<BR>select * from table order by &variablepassed<BR><BR>If so can you provide some sample code for me, the stored procedure and the ASP to use with it. I currently just execute my stored procedures like this <BR>set rsreplist=conntemp1.Execute("sp_getreps")<BR><BR>T hanks all.<BR><BR>Eric

  2. #2
    Tony Guest

    Default RE: Passing values to a SQL 6.5 Stored Procedure

    Try this in SQLSRVR:<BR>-------------------------<BR>CREATE PROC sp_getreps (@orderfld varchar(20)) <BR>AS <BR>DECLARE strSQL varchar(255)<BR>SELECT strSQL = &#039SELECT * FROM TableReps ORDER BY &#039 + @orderfld<BR>EXEC (strSQL)<BR>RETURN<BR>-------------------------<BR><BR>And in ASP, assuming repname is a valid fieldname in TableReps:<BR>-------------------------<BR>set rsreplist=conntemp1.Execute("sp_getreps repname")<BR>-------------------------<BR>Good Luck!<BR>

Posting Permissions

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