Home > Archive > SQL Anywhere Mobile > May 2005 > How to tell if a publication already exists?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to tell if a publication already exists?
Chance

2005-05-12, 9:25 am

1. Is there a way to query the system tables to see if a publication exists?
2. Is there a way to query the system tables to see if a table exists within
a publication?

If so, can someone provide an example.

tia,
chance.


Reg Domaratzki \(iAnywhere Solutions\)

2005-05-12, 9:25 am

if exist( select 1 from SYSPUBLICATION sp key join SYSUSERPERM su where
sp.publication_name = 'p1' and su.user_name = 'DBA' ) then
message 'Publication DBA.p1 exists';
else
message 'Publication DBA.p1 does NOT exist';
end if;

if exist( select 1 from SYSARTICLE sa key join SYSPUBLICATION sp key join
SYSUSERPERM su key join SYSTABLE st where st.table_name = 'EMP' and
sp.publication_name = 'p1' and su.user_name = 'DBA' ) then
message 'Table EMP exists in publication DBA.p1';
else
message 'Table EMP does NOT exist in publication DBA.p1';
end if;

--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL

"Chance" <chance@booklog.com> wrote in message news:4283635a@forums
-1-dub...
> 1. Is there a way to query the system tables to see if a publication

exists?
> 2. Is there a way to query the system tables to see if a table exists

within
> a publication?
>
> If so, can someone provide an example.
>
> tia,
> chance.
>
>



Philippe Bucaille

2005-05-12, 11:24 am

existence of a publication :

SELECT 1 FROM SYS.SYSPUBLICATION WHERE publication_name = 'your publication
name'

existence of a table within publication :

select 1 from sys.sysarticle where table_id = (select table_id from
sys.systable where table_name = 'your table name')


"Chance" <chance@booklog.com> a écrit dans le message de
news:4283635a@forums
-1-dub...
> 1. Is there a way to query the system tables to see if a publication

exists?
> 2. Is there a way to query the system tables to see if a table exists

within
> a publication?
>
> If so, can someone provide an example.
>
> tia,
> chance.
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com