-
Get a rownumber/amount of fields/columns in a query
Not nice but a work around: is there a way to get the amount of fields or rows from a table or query within MS SQL, to pick out the lastfield-4 for example ?
SELECT LASTFIELD-4
FROM CUSTOMERS
Thanks
-
Get a rownumber/amount of fields/columns in a query (reply)
Yes, but the order seems to be a bit unpredictable unless you use ORDER BY in your cursor declaration:
declare @records_from_end int, @absrow int
select @records_from_end = [NUMBER OF ROWS FROM END, I.E. LAST ROW = 0]
select @absrow = @records_from_end * -1 -1
declare cr scroll cursor for
select * from [TABLE NAME] order by [FIELD NAME TO ORDER BY]
open cr
fetch absolute @absrow from cr
close cr
deallocate cr
------------
Frans at 7/5/00 7:43:57 AM
Not nice but a work around: is there a way to get the amount of fields or rows from a table or query within MS SQL, to pick out the lastfield-4 for example ?
SELECT LASTFIELD-4
FROM CUSTOMERS
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|