Sorry, ignore my previous post (did not notice order by ;-)).
Main Topics
Browse All TopicsI have a very simple UDF Function doing a :
select TOP 100 PERCENT CLI_Name from CLI_Clients order by CLI_Name
The order by works well with SQL 2000 and does not work anymore after migrating to 2005.
Any clue ???
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ok, this behavoiur is now a default behaviour for views and UDFs in SQL Server 2005. What you can do is one of two things (both require code modification): add a column generated with ROW_NUMBER() function to the resultset or change TOP 100 PERCENT to TOP <something_very_close_to_1
Effectively, select TOP 99.99999999 PERCENT works, and not TOP 100 PERCENT.
This is so logical :)
Could you specify a little bit about adding a column generated with row number ? Actually, our UDF function is a little more complex, and does include the index :
SELECT TOP 100 PERCENT CLI_ID, CLI_NAME from CLI_Clients order by CLI_Name
where CLI_ID is an auto number and is the key.
Business Accounts
Answer for Membership
by: brejkPosted on 2008-02-11 at 02:27:36ID: 20865177
You can't count on any sort order when you don't use ORDER BY clause.