Sort Oder not as I planned

  • Thread starter AkAlan via AccessMonster.com
  • Start date
A

AkAlan via AccessMonster.com

I have a view created with a sort order on the SiteName field but it sorts in
the SiteID field. Am I missing simething here?

SELECT DISTINCT TOP 100 PERCENT dbo.QcCar.SiteID, dbo.QcSites.SiteName
FROM dbo.QcSites RIGHT OUTER JOIN
dbo.QcCar ON dbo.QcSites.QcSitesId = dbo.QcCar.SiteID
WHERE (dbo.QcCar.QcFinalReviewDate IS NULL)
ORDER BY dbo.QcSites.SiteName
 
S

Sylvain Lafontaine

There are no sorting order in Views because they are interpreted like
tables. Under some circonstances, adding a TOP 100 PERCENT will give you
the impression that this work but as you might now see, this doesn't work
100% of the time on all platforms/applications.

Use a Select statement to query your view and add your Order By to it.
 
A

AkAlan via AccessMonster.com

Perfect, Thanks

Sylvain said:
There are no sorting order in Views because they are interpreted like
tables. Under some circonstances, adding a TOP 100 PERCENT will give you
the impression that this work but as you might now see, this doesn't work
100% of the time on all platforms/applications.

Use a Select statement to query your view and add your Order By to it.
I have a view created with a sort order on the SiteName field but it sorts
in
[quoted text clipped - 6 lines]
WHERE (dbo.QcCar.QcFinalReviewDate IS NULL)
ORDER BY dbo.QcSites.SiteName
 
A

asus

AkAlan via AccessMonster.com said:
I have a view created with a sort order on the SiteName field but it sorts
in
the SiteID field. Am I missing simething here?

SELECT DISTINCT TOP 100 PERCENT dbo.QcCar.SiteID, dbo.QcSites.SiteName
FROM dbo.QcSites RIGHT OUTER JOIN
dbo.QcCar ON dbo.QcSites.QcSitesId =
dbo.QcCar.SiteID
WHERE (dbo.QcCar.QcFinalReviewDate IS NULL)
ORDER BY dbo.QcSites.SiteName
 
B

Bob Snedden

Dear Sylvain,

I have an important customer who has upgraded to SQL Server 2005 with 9 ADP
databases I have designed for them.

This upgrade was done for replication purposes for other SQL Server
applications not my databases.

From you reply to this post - Am I now having to update all comboboxes to
use store procedures or to use SELECT statements from Views in order to get
sorted lists?

This looks like a mountain of work but I assume because 2005 treats Views as
Tables unlike 200.
--
Bob Snedden, MCT, MCSD.Net


Sylvain Lafontaine said:
There are no sorting order in Views because they are interpreted like
tables. Under some circonstances, adding a TOP 100 PERCENT will give you
the impression that this work but as you might now see, this doesn't work
100% of the time on all platforms/applications.

Use a Select statement to query your view and add your Order By to it.
 
S

Sylvain Lafontaine

You can try replacing the TOP 100% in the Views with something like TOP
2000000000.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Bob Snedden said:
Dear Sylvain,

I have an important customer who has upgraded to SQL Server 2005 with 9
ADP
databases I have designed for them.

This upgrade was done for replication purposes for other SQL Server
applications not my databases.

From you reply to this post - Am I now having to update all comboboxes to
use store procedures or to use SELECT statements from Views in order to
get
sorted lists?

This looks like a mountain of work but I assume because 2005 treats Views
as
Tables unlike 200.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top