Hi Greg,
I am using SQL queries as in-script and now decided to use them as stored procedure. I am facing some problem while converting them into stored procedures. It’s a book search functionality based on book name and author name.
My Old SQL query, which I was using with asp.
SQL = “Select * From Tbl_Name Where Name LIKE '%xyz%' ” & strOrderBy
Where strOrderBy is provided by user input at the time of search, so that they can sort book listing as they want.
Variable strOrderBy, is asp variable and its value being determined by user at the time of search. I was passing the value of strOrderBy like this.
Select Case strOrderByInput
Case "pubdateasc"
strOrderBy = "Order by publication DESC”
Case "bookname"
'strOrderBy = " Order by BookName ASC "
Case "Author"
'strOrderBy = " Order by AuthorName ASC "
Case Else
strOrderBy = " Order by publication ASC"
End Select
The whole thing is working fine when im using this in ASP as in-line query, but when I changed it into stored procedure. I am not able to pass strOrderBy variable as I was doing it earlier. Please can you help me how to do this in stored procedure?
Regards
Anil
Software/Hardware used:
ASKED:
March 20, 2008 3:34 PM
UPDATED:
March 21, 2008 12:35 AM
Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.