|
Posted by Andrew Lias on 09/27/29 11:43
I've been given a task that I believe is, basically, impossible, but
I'd like to see if there's a way to do it.
What my boss wants me to do is to create a view, in SQL Server 2000,
that will provide not only a row number field of some sort, but that
will produce sequential ordering for arbitrary selects and orderings.
So, if my data is a table with values from A thru D and my user does
SELECT data FROM vwTable, the result would be:
Row Data
--- ----
1 A
2 B
3 C
4 D
But is they did SELECT data FROM vwTable ORDER BY data DSC, they would
get
Row Data
--- ----
1 D
2 C
3 B
4 A
And if the did SELECT data FROM vwTable WHERE Data IN ('B', 'C'), they
would get
Row Data
--- ----
1 B
2 C
In SQL 2005, of course, this would be fairly trivial since I could use
the ROW_NUMBER function. In 2000, though, it seems to be utterly
impossible. My boss, however, is convinced that there must be some way
to create a calculated field to do it.
I'll be cursed if I can figure out a way to do so.
Any suggestions would be appreciated.
Navigation:
[Reply to this message]
|