sql - Is it possible to have a user input to a sort -
is possible have sql query , how sort user input textbox, trying records table date user input
select orderdate date, orderpizzatotals 'pizzas sold', orderdrinktotals 'drinks sold', orderpricetotal 'transaction total' dbo.[order] sort "userinput.text"
it possible sort based on dynamic information (e.g. parameter pass code) if use dynamic sql in sql server:
declare @userinput nvarchar(100) = 'your_column' declare @sql nvarchar(1000) = n'select orderdate date, orderpizzatotals ''pizzas sold'', orderdrinktotals ''drinks sold'', orderpricetotal ''transaction total'' dbo.[order] order ' + @userinput exec sp_executesql @sql
Comments
Post a Comment