1

I have one temp_table which consists of more than 80K rows. In aqua I am unable to do select * on this table due to space/memory limitation I guess.

select * from #tmp

Is there any way to do select query range by range?

For eg:- give me first 10000 records and next 10000 and next 10000 till the end.

Note:-

   1) I am using Aqua Data Studio, where I am restricted to select max 5000 rows in one select query.

   2) I am using Sybase, which somehow doesn't allow  'except' and 'select top @var from table' syntax and ROWNUM() is not avaliable

Thanks!!

suraj_fale
  • 978
  • 2
  • 21
  • 53
  • You can do it through a procedure. – Rahul May 27 '15 at 15:42
  • possible duplicate of [How to get N rows starting from row M from sorted table in T-SQL](http://stackoverflow.com/questions/758186/how-to-get-n-rows-starting-from-row-m-from-sorted-table-in-t-sql) – Sid M May 27 '15 at 15:52
  • possible duplicate of [Sybase offset for pagination](http://stackoverflow.com/questions/7759166/sybase-offset-for-pagination) – rutter May 27 '15 at 16:26
  • Check that!! http://dba.fyicenter.com/Interview-Questions/SYBASE/Selecting_rows_N_to_M_without_Oracles_rownum_in_.html – Alejandro Teixeira Muñoz Jun 10 '15 at 22:16

3 Answers3

0

Can you not use something like with where clause on some id in the table

select top n * from table where some_id > current_iteration_starting_point

e.g

select top 200 * from tablename where some_id >  1 

and keep increasing the iteration_starting_point say from 1 to 201 in the next iteration and so on.

gopal
  • 63
  • 1
  • 9
0

You can use something like the following in SQL Server. Just update @FirstRow for each new iteration.

declare @FirstRow int = 0
declare @Rows int = 10000

select top (@FirstRow+@Rows) * from Table
except
select top (@FirstRow) * from Table

set @FirstRow = @FirstRow + @Rows

select top (@FirstRow+@Rows) * from Table
except
select top (@FirstRow) * from Table
Sentinel
  • 6,379
  • 1
  • 18
  • 23
0

Here is documentation on how to increase the memory capacity of Aqua Data Studio :

https://www.aquaclusters.com/app/home/project/public/aquadatastudio/wikibook/Documentation16/page/50/Launcher-Memory-Configuration

tariq
  • 615
  • 5
  • 12