sql query (dynamic/user input)

i am tryin to write a sql select query that need input from user at runtime

there is field with products which can have several entries -
eg. grains,oil, steel

I want my query to search all rows containing steel (user inputs at runtime)

i need syntax please
 
Well, how do you plan to call this SQL? Do you want it in a stored proc or inline?

You could do something like
Code:
SELECT * FROM Products WHERE Type = @Type
A stored proc would be nice
Code:
CREATE PROCEDURE [MySchema].[GetProductListing]
(
     @Type VARCHAR(24)
)
AS
BEGIN
     SELECT * FROM Products WHERE Type = @Type
END
 
Back
Top