batchakamal
asked on
Microsoft, SQL Server, 2005, view with order by clause
Hi,
I have crated a view with Top 100 Percent in the Select Clause and an order by Column name. It is working fine when I execute the view in the Enterprise Manager.
But When I put,
Select * from View1
It is not giving the sorted result.
I have crated a view with Top 100 Percent in the Select Clause and an order by Column name. It is working fine when I execute the view in the Enterprise Manager.
But When I put,
Select * from View1
It is not giving the sorted result.
in views, you need to use the following method to allow sortings:
CREATE VIEW view_name
AS
SELECT TOP 100 PERCENT ...
FROM ...
WHERE ...
ORDER BY ...
sorry, I notice you did that :(
how many CPU does your server have?
Check whether there exists another view with the same name and different owner ?
ASKER
We have Only one processor
ASKER
If I put
Select * From View1 Order By Column2
It is working fine. But I require it to sort when I select.
Select * From View1 Order By Column2
It is working fine. But I require it to sort when I select.
ASKER
There is only one view with that name.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It Works out. But I would like to know whether this will affect our performance or not.
Select * from View1 order by columnname
i think top 100% order by x simply tells it to collect: up to 100%, by order of column x. it can do that using multiple threads and arrive at some result. but because it's a view, it's the the final result. the result gets dumped in any order (that threads complete)