Simply, I have this SQL statment:
EXEC xp_cmdshell 'tasklist'
can we order or filter the results by using order by
or where
?
Thanks,
The ORDER BY statement in SQL is used to sort the fetched data in either ascending or descending according to one or more columns. By default ORDER BY sorts the data in ascending order. We can use the keyword DESC to sort the data in descending order and the keyword ASC to sort in ascending order.
from inside the procedure, the commands run in the order you created them in, and there is no way for the third to execute before the previous commands complete.
A view is essentially a saved SQL statement. Therefore, I would say that in general, a stored procedure will be likely to be faster than a view IF the SQL statement for each is the same, and IF the SQL statement can benefit from optimizations. Otherwise, in general, they would be similar in performance.
We can not directly use stored procedures in a SELECT statement.
I checked jamietre link, and this is the complete answer:
Create table #MyTempTable (output varchar(max)) INSERT INTO #MyTempTable EXEC xp_cmdshell 'tasklist' select * from #MyTempTable where output like 'ie%' order by output
Thanks for all...
You need to output the results into a temporary table first. This should show you how to do it
Insert results of a stored procedure into a temporary table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With