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
SELECT * FROM Products WHERE Type = @Type
A stored proc would be nice
CREATE PROCEDURE [MySchema].[GetProductListing]
(
@Type VARCHAR(24)
)
AS
BEGIN
SELECT * FROM Products WHERE Type = @Type
END