I am using SQL Server queries as in-script and I have now decided to use the queries as stored procedures. However, I am facing some problems while converting the SQL Server queries 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, is as follows:
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
strOrderBy = "Order by publication DESC
'strOrderBy = "Order by BookName ASC"
'strOrderBy = "Order by AuthorName ASC"
strOrderBy = "Order by publication ASC"
The whole thing is working fine when I’m using this in ASP as in-line query. However, when I changed it into stored procedures, I am not able to pass strOrderBy variable as I was doing earlier. How do I accomplish this using it as a stored procedure?
March 21, 2008 8:38 PM
March 22, 2008 12:20 AM