View Single Post
Old Jun 3rd, 2007, 2:07 AM   #1
King
Professional Programmer
 
King's Avatar
 
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 364
Rep Power: 0 King is an unknown quantity at this point
SQL Query Problem

I am trying to write a SQL stored procedure that will search a certain field in a table. This is what I have so far:
CREATE PROCEDURE pSearchRecords
(
 @Category varchar(50),
 @Search varchar(50)
)
AS
SELECT * FROM tAddressBook
WHERE @Category = @Search
@Category is the field I want to search, and @search is the text I want to search for in that field. The problem is when I go "@Category = @Search", it checks the actual value of the variable @Category instead of using that value as the field I want to search. Does anyone know how I can do this properly? Thanks.
__________________
I am Addicted to Linux!
King is offline   Reply With Quote