Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2004-12-28 : 12:24:23
|
| I run the following in QA without any problems. It's combining a table and another view via a Union. However when I run it as a View, it does not sort by ABALPH. How come?CREATE VIEW dbo.Lab_CustomersASSELECT TOP 100 PERCENT ABALPH AS CustomerName, ABMCU AS Location, ABAN8 AS CustomerNoFROM PRODDTA.F0101WHERE (ABAT1 = 'CS')UNIONSELECT TOP 100 PERCENT Description AS ABALPH, MarketSegment AS Location, CAST(MarketSegment AS FLOAT) AS CustomerNoFROM dbo.MarketSegmentsORDER BY ABALPHTIA, |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-28 : 12:29:30
|
| It does't always honour it.try this - SELECT TOP 100 PERCENT *from(ABALPH AS CustomerName, ABMCU AS Location, ABAN8 AS CustomerNoFROM PRODDTA.F0101WHERE (ABAT1 = 'CS')UNIONSELECT Description AS ABALPH, MarketSegment AS Location, CAST(MarketSegment AS FLOAT) AS CustomerNoFROM dbo.MarketSegments) aORDER BY CustomerName==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2004-12-28 : 12:43:28
|
| That did it. Thanks. |
 |
|
|
|
|
|