SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Ordering in a View
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CleverRainbow
Starting Member

3 Posts

Posted - 06/01/2012 :  23:21:44  Show Profile  Reply with Quote
Basically i'm trying to insert an order by function into a view, but this can only be done using TOP. What I have at the moment does not order anything, however; if I change "top 100 percent" to "top 99.9 percent" it will order only the 'Fname' and leave 'Lname' unordered.

USE dbo.
GO
CREATE VIEW wwOverdueVideos AS
SELECT TOP 100 PERCENT Fname, Lname
FROM Member
ORDER BY Fname, Lname ASC
GO

visakh16
Very Important crosS Applying yaK Herder

India
47173 Posts

Posted - 06/01/2012 :  23:37:28  Show Profile  Reply with Quote
there's no use in giving ORDER BY inside view as it will not guarantee order of returning resultset. For that you need to give order by in select statement which retrives details from the view like

SELECT * FROM wwOverdueVideos ORDER BY Fname, Lname ASC


see

http://visakhm.blogspot.com/2010/01/behaviour-of-order-by-inside-view.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000