Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    52

    Angry Unanswered: 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???

  2. #2
    Join Date
    Feb 2004
    Posts
    8

    Re: order by in a View

    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???
    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.

  3. #3
    Join Date
    Feb 2004
    Posts
    5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •