Does anyone know why my view is completely ignoring my ORDER clause?
To make it more confusing, when I have it open in DESIGN view and execute it, it works fine. When I open it, without first viewing it in design view, the results are unordered. Crazy!!
The SQL is below:
SELECT TOP (100) PERCENT DateFirstAppeared, SEDOLFODB, HeaderDescriptionFODB, BaseFundCodeFODB, NotionalFODB, SEDOLSystem,
BaseFundCodeSystem, NotionalSystem, RunNumber, Comments, Level1Authorisation, Level2Authorisation, Level1SignedOffDate,
Level2SignedOffDate, SignOffFlag, KnownExceptionFlag, FinalExceptionsHistoryFlag
FROM dbo.vwView1 AS A
WHERE (NOT EXISTS
(SELECT DateFirstAppeared, SEDOLFODB, HeaderDescriptionFODB, BaseFundCodeFODB, NotionalFODB, SEDOLSystem, BaseFundCodeSystem,
NotionalSystem, RunNumber, Comments, Level1Authorisation, Level2Authorisation, Level1SignedOffDate, Level2SignedOffDate,
SignOffFlag, KnownExceptionFlag, 'FALSE' AS FinalExceptionsHistoryFlag
FROM dbo.vwFinalExceptionsVrsExceptionsSystem1 AS B
WHERE (A.DateFirstAppeared = DateFirstAppeared) AND (A.SEDOLFODB = SEDOLFODB) AND (HeaderDescriptionFODB = HeaderDescriptionFODB)
AND (A.BaseFundCodeFODB = BaseFundCodeFODB) AND (A.NotionalFODB = NotionalFODB) AND (A.SEDOLSystem = SEDOLSystem) AND
(A.BaseFundCodeSystem = BaseFundCodeSystem) AND (A.NotionalSystem = NotionalSystem) AND (A.RunNumber = RunNumber) AND
(A.Comments = Comments) AND (A.Level1Authorisation = Level1Authorisation) AND (A.Level2Authorisation = Level2Authorisation) AND
(A.Level1SignedOffDate = Level1SignedOffDate) AND (A.Level2SignedOffDate = Level2SignedOffDate) AND (A.SignOffFlag = SignOffFlag)
AND (A.KnownExceptionFlag = KnownExceptionFlag) AND (A.FinalExceptionsHistoryFlag = FinalExceptionsHistoryFlag)))
ORDER BY Level1Authorisation DESC, Level2Authorisation DESC
To make it more confusing, when I have it open in DESIGN view and execute it, it works fine. When I open it, without first viewing it in design view, the results are unordered. Crazy!!
The SQL is below:
SELECT TOP (100) PERCENT DateFirstAppeared, SEDOLFODB, HeaderDescriptionFODB, BaseFundCodeFODB, NotionalFODB, SEDOLSystem,
BaseFundCodeSystem, NotionalSystem, RunNumber, Comments, Level1Authorisation, Level2Authorisation, Level1SignedOffDate,
Level2SignedOffDate, SignOffFlag, KnownExceptionFlag, FinalExceptionsHistoryFlag
FROM dbo.vwView1 AS A
WHERE (NOT EXISTS
(SELECT DateFirstAppeared, SEDOLFODB, HeaderDescriptionFODB, BaseFundCodeFODB, NotionalFODB, SEDOLSystem, BaseFundCodeSystem,
NotionalSystem, RunNumber, Comments, Level1Authorisation, Level2Authorisation, Level1SignedOffDate, Level2SignedOffDate,
SignOffFlag, KnownExceptionFlag, 'FALSE' AS FinalExceptionsHistoryFlag
FROM dbo.vwFinalExceptionsVrsExceptionsSystem1 AS B
WHERE (A.DateFirstAppeared = DateFirstAppeared) AND (A.SEDOLFODB = SEDOLFODB) AND (HeaderDescriptionFODB = HeaderDescriptionFODB)
AND (A.BaseFundCodeFODB = BaseFundCodeFODB) AND (A.NotionalFODB = NotionalFODB) AND (A.SEDOLSystem = SEDOLSystem) AND
(A.BaseFundCodeSystem = BaseFundCodeSystem) AND (A.NotionalSystem = NotionalSystem) AND (A.RunNumber = RunNumber) AND
(A.Comments = Comments) AND (A.Level1Authorisation = Level1Authorisation) AND (A.Level2Authorisation = Level2Authorisation) AND
(A.Level1SignedOffDate = Level1SignedOffDate) AND (A.Level2SignedOffDate = Level2SignedOffDate) AND (A.SignOffFlag = SignOffFlag)
AND (A.KnownExceptionFlag = KnownExceptionFlag) AND (A.FinalExceptionsHistoryFlag = FinalExceptionsHistoryFlag)))
ORDER BY Level1Authorisation DESC, Level2Authorisation DESC