unable to use % in stored procedures - pls help...
CREATE PROCEDURE SP_listByAuthor
(
@bookAuthor varchar(20)
)
AS
SELECT dbo.BOOKS.bookID,dbo.BOOKS.bookTitle,dbo.BOOKS.bookAuthor,dbo.BOOKS.bookISBN,dbo.BOOKS.bookPublisher,dbo.BOOKS.bookYearPublished,dbo.BOOKS.bookDateReceived,dbo.BOOKS.bookCategory,dbo.BOOKS.bookLoanStatus
FROM dbo.BOOKS
where dbo.BOOKS.bookAuthor LIKE %@bookAuthor% <-- errors occur from this keywords
can anyone tell me how to use % in stored procedures ?
i tried
'%@bookAuthor%'
%@bookAuthor%
but errors still occur when i check the syntax. but when i try the same query in query analyser, it able to retrieve data without errors.
pls help...