niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Sybase
query for: is table X partitioned?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
bravegag
*nix forums beginner


Joined: 12 Apr 2006
Posts: 16

PostPosted: Mon Jul 03, 2006 3:02 pm    Post subject: query for: is table X partitioned? Reply with quote

Hi all,

Our project has a large number of tables and we need some generic
method to truncate them all (dropping tables is out of the question),
the problem is that some of the tables are partitioned and some
aren't. I can implement the feature above easily as a stored procedure
but I still miss the bit to tell whether a table is partitioned or not
.... needed because you need to unpartition it before truncating and
then repartition it back to the same number it was before.

I need a query that has the following interface:

select ispartitioned (e.g. 'partitioned', 'unpartitioned'),
numpartitions (e.g. 5)
from ...
where object_id('table_name') = id

Thanks in advance,
Best Regards,
Giovanni
Back to top
DBAGAL
*nix forums beginner


Joined: 31 May 2005
Posts: 39

PostPosted: Tue Jul 04, 2006 11:16 pm    Post subject: Re: query for: is table X partitioned? Reply with quote

Hi Giovanni,

select object_name(id), numpartitions=count(*)
from syspartitions
group by object_name(id)

This works for pre ASE 15.0 systems ... the syspartitions table has
been completely redone for 15.0.

Cheers,

Sara ...

bravegag wrote:
Quote:
Hi all,

Our project has a large number of tables and we need some generic
method to truncate them all (dropping tables is out of the question),
the problem is that some of the tables are partitioned and some
aren't. I can implement the feature above easily as a stored procedure
but I still miss the bit to tell whether a table is partitioned or not
... needed because you need to unpartition it before truncating and
then repartition it back to the same number it was before.

I need a query that has the following interface:

select ispartitioned (e.g. 'partitioned', 'unpartitioned'),
numpartitions (e.g. 5)
from ...
where object_id('table_name') = id

Thanks in advance,
Best Regards,
Giovanni
Back to top
amarnadh@iitb.ac.in
*nix forums beginner


Joined: 14 May 2005
Posts: 2

PostPosted: Wed Jul 12, 2006 6:45 am    Post subject: Re: query for: is table X partitioned? Reply with quote

Hi ,

select object_name(id), count(*) partitoned
from syspartitions
where indid = 0 or indid = 1
group by id, indid
having count(*) > 1

This query will give all the partitioned tables in the database. (for
ASE - 15.0)

select object_name(id), count(*) partitoned
from syspartitions
where indid = 0 or indid = 1
group by id, indid
having count(*) = 1

This query will give all the un-partitioned tables in the database (for
ASE-15.0)

You can extend these queries as per your requirements.

Thanks,
Amarnadh.




DBAGAL wrote:
Quote:
Hi Giovanni,

select object_name(id), numpartitions=count(*)
from syspartitions
group by object_name(id)

This works for pre ASE 15.0 systems ... the syspartitions table has
been completely redone for 15.0.

Cheers,

Sara ...

bravegag wrote:
Hi all,

Our project has a large number of tables and we need some generic
method to truncate them all (dropping tables is out of the question),
the problem is that some of the tables are partitioned and some
aren't. I can implement the feature above easily as a stored procedure
but I still miss the bit to tell whether a table is partitioned or not
... needed because you need to unpartition it before truncating and
then repartition it back to the same number it was before.

I need a query that has the following interface:

select ispartitioned (e.g. 'partitioned', 'unpartitioned'),
numpartitions (e.g. 5)
from ...
where object_id('table_name') = id

Thanks in advance,
Best Regards,
Giovanni
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Sun Nov 23, 2008 12:51 pm | All times are GMT
navigation Forum index » Databases » Sybase
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Very slow query Michael Sutter MySQL 0 Fri Jul 21, 2006 1:10 pm
No new posts How to ALTER a table using the ALTOBJ procedure Serge Rielau IBM DB2 1 Fri Jul 21, 2006 1:06 pm
No new posts Can't Select External Table from CSV File Resant Server 1 Fri Jul 21, 2006 2:45 am
No new posts Column info without executing query Dan Strömberg PostgreSQL 10 Thu Jul 20, 2006 6:21 pm
No new posts recursive query Jürg Schaufelberger Server 1 Thu Jul 20, 2006 6:06 pm

Mortgage Loans | Credit Card Consolidation | Mortgage | Charity | Loans
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1705s ][ Queries: 16 (0.0969s) ][ GZIP on - Debug on ]