March 26, 2007 at 12:41 pm
I saw a programmer using SELECT TOP 100 PERCENT in creating a veiw in SQL Server 2005. I thought it was removed by Microsoft.
So can we use SELECT TOP 100 PERCENT in Create view or not?
I am confused !
March 26, 2007 at 12:57 pm
TOP 100 PERCENT has not been removed from use it just changed the way it works.
See this nice little write up here
http://www.sqlskills.com/blogs/kimberly/PermaLink.aspx?guid=79de45cb-2da6-4510-ae43-7e5e42e4c02e
March 26, 2007 at 12:59 pm
You can use it, it just won't return a sorted result set if the order by is included in the view declaration. A view is a table and SQL (not SQL Server) does not guarantee on order for a table.
hth.
March 27, 2007 at 12:00 am
Even when an order by is within the view, chances are that someone just put it in to select the view and see the data sorted like specified in the order by clause (sql2000).
This is nolonger the case with SQL2005.
Reason for this ? The order by in the view, only serves the dataselection of the view itself.
If you want to retreive data in an ordered way, specify an order by in your query.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply