Monday, March 26, 2012

order by in a View

i m required to use order by in a view, how to do it, simple order by doesn't work for it, any other way,i have heard there is one in oracle, but wat abt SQL Server?:confused:Originally posted by waqas
i m required to use order by in a view, how to do it, simple order by doesn't work for it, any other way,i have heard there is one in oracle, but wat abt SQL Server?:confused:

The only way I know how to ORDER a view is to SELECT from your view then ORDER BY what you want. I don't know of any way to do this when you create the view.|||Here's a sneaky workaround:

Create View MyView As
Select
top 100 percent
field1,
field2
from
mytable
order by
field1

Normally you would apply order by to a result set. You might want to use a stored procedure if the result set must be ordered.sql

No comments:

Post a Comment