Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > Sybase

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 06:16 PM
runescience
 
Posts: n/a
Default Need a way to maintain sorted records for long periods of time. "select into" temp table?

Hi Folks. I have a large number of records that are deliverd for web
view.
This may sound a bit wierd but its a user requirement.

I will have 100,000 records for view to the user. Currently I send
records to a temp tableand view them in a web page in java. There I use
the "<< < 1 2 3 4 5... 99 100 > >>" method at the bottom of the
page to allow the user to view the chunks.

select * from tablename where rowid > first chunk and rowid < next
chunk.

Now the user wishes to do a sort on up to 3 columns. This ruins my old
method of doing things. I cant scroll out chunks, because a select (
Select * from table name order by col8, col6, col3 ) does not reorder
the rowid.

So, then I thought of doing a 'Select into' a new temp table. But,
then I have to keep track of the new temp table name each time. I read
some where, and I hope its correct, that when you create a temp table
any new records are stored in order of the select into.

Every time the user chooses a new way to sort the data from the web
page, I think I should create a new Temptable, unless there is some way
to update the rowid on the original table. The sorted data order must
be maintailed over multiple sessions. there will be only one user, but
when he is done with this I can ditch the temp table till he creates
new data.


Im not sure this is the way to go. But, I need to finish it soon.
Suggestions? solutions?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 06:16 PM
Rob Verschoor
 
Posts: n/a
Default Re: Need a way to maintain sorted records for long periods of time. "select into" temp table?

In ASE 15 , you could use scrollable cursors for this. In pre-15, you'll
have to handle the scrolling yourself, for example through a temporary
table.

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5 / TeamSybase

Author of Sybase books (order online at www.sypron.nl/shop):
"Tips, Tricks & Recipes for Sybase ASE"
"The Complete Sybase Replication Server Quick Reference Guide"
"The Complete Sybase ASE Quick Reference Guide"

mailto:rob@YOUR.SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------

"runescience" <runescience@yahoo.com> wrote in message
news:1138629334.581707.173070@z14g2000cwz.googlegr oups.com...
> Hi Folks. I have a large number of records that are deliverd for web
> view.
> This may sound a bit wierd but its a user requirement.
>
> I will have 100,000 records for view to the user. Currently I send
> records to a temp tableand view them in a web page in java. There I use
> the "<< < 1 2 3 4 5... 99 100 > >>" method at the bottom of the
> page to allow the user to view the chunks.
>
> select * from tablename where rowid > first chunk and rowid < next
> chunk.
>
> Now the user wishes to do a sort on up to 3 columns. This ruins my old
> method of doing things. I cant scroll out chunks, because a select (
> Select * from table name order by col8, col6, col3 ) does not reorder
> the rowid.
>
> So, then I thought of doing a 'Select into' a new temp table. But,
> then I have to keep track of the new temp table name each time. I read
> some where, and I hope its correct, that when you create a temp table
> any new records are stored in order of the select into.
>
> Every time the user chooses a new way to sort the data from the web
> page, I think I should create a new Temptable, unless there is some way
> to update the rowid on the original table. The sorted data order must
> be maintailed over multiple sessions. there will be only one user, but
> when he is done with this I can ditch the temp table till he creates
> new data.
>
>
> Im not sure this is the way to go. But, I need to finish it soon.
> Suggestions? solutions?
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 06:16 PM
Dhannya
 
Posts: n/a
Default Re: Need a way to maintain sorted records for long periods of time. "select into" temp table?

Can we access rowid in Sybase?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 06:16 PM
Rob Verschoor
 
Posts: n/a
Default Re: Need a way to maintain sorted records for long periods of time. "select into" temp table?

In ASE, you can use an identity column to simulate the concept of a rowid.

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5 / TeamSybase

Author of Sybase books (order online at www.sypron.nl/shop):
"Tips, Tricks & Recipes for Sybase ASE"
"The Complete Sybase Replication Server Quick Reference Guide"
"The Complete Sybase ASE Quick Reference Guide"

mailto:rob@YOUR.SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------

"Dhannya" <dhannyasm@gmail.com> wrote in message
news:1138631475.735956.308070@z14g2000cwz.googlegr oups.com...
> Can we access rowid in Sybase?
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 06:16 PM
runescience
 
Posts: n/a
Default Re: Need a way to maintain sorted records for long periods of time. "select into" temp table?

i think so we can, i am using sybase IQ 12.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 06:16 PM
runescience
 
Posts: n/a
Default Re: Need a way to maintain sorted records for long periods of time. "select into" temp table?

How would a scrollable cursor help here?

I would hae to make a new cursor each time for each time the sort is
re-done.

The cursor is not persistant from java session to java session, I think
I would have to resort them each time.

I need to have the rowID updated into a new temp table each time.

Am I missing something? could you maybe re-read the original post?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-08-2008, 06:16 PM
Michael Peppler
 
Posts: n/a
Default Re: Need a way to maintain sorted records for long periods of time. "select into" temp table?

On Mon, 30 Jan 2006 05:55:34 -0800, runescience wrote:

> Hi Folks. I have a large number of records that are deliverd for web view.
> This may sound a bit wierd but its a user requirement.
>
> I will have 100,000 records for view to the user. Currently I send records
> to a temp tableand view them in a web page in java. There I use the "<<
> < 1 2 3 4 5... 99 100 > >>" method at the bottom of the page to allow
> the user to view the chunks.
>
> select * from tablename where rowid > first chunk and rowid < next chunk.
>
> Now the user wishes to do a sort on up to 3 columns. This ruins my old
> method of doing things. I cant scroll out chunks, because a select (
> Select * from table name order by col8, col6, col3 ) does not reorder the
> rowid.
>
> So, then I thought of doing a 'Select into' a new temp table. But, then I
> have to keep track of the new temp table name each time. I read some
> where, and I hope its correct, that when you create a temp table any new
> records are stored in order of the select into.


I would use a secondary table that only has the original row id (or
identity value) for the row, and a second column that has the row id for
the sorted data. Creating this second table should be pretty fast, and you
can then do the retrieves based on the two tables (a simple join with an
order by on the second table's row id).

You can also simplify your code by always using the two table method. For
the original sort you simply have the secondary table with identical
column values.

Michael
--
Michael Peppler [TeamSybase] mpeppler@peppler.org - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:47 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145