I have a table with ticketID, clientmachineName and UserName columns. i need to write a stored procedure where i have to pass each column name as parameter and value also as parameter.
It should write output query as
select * from table where @cloumn=@value.
can anyone help please..
you will need dynamic SQL like:
DECLARE @myquery varchar(1000) = 'select * from table where ' + @column + '=''' + @value + ''''
EXEC @myquery
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.