I have an app where I want to do a generic search. Meaning I want the user to choose the column to search on and type in a search string.
So I want to be able to use two parameters in my sproc as follows:
SELECT * from table where @searchColumn = @searchValue
I realize this is very basic but its also very useful and I have a hard time finding good and direct sql help.
Also How can I print out my sql in this scenario to the screen so I can see how it looks?
for example: @sql = 'select * from table where ' + @searchColumn + '=' + @searchValue