How to get DDL for database objects shared to other user?
<p>We are working on extracting database DDL of Sybase ASE 15.5 version. We have one sample created in java that execute ddl commands. We got ddl using ddlgen utility provided by Sybase with commands :</p>

<pre><code>java -cp "mypath/lib/jconn4.jar;mypath/lib/dsparser.jar;mypath/lib/DDLGen.jar" com.sybase.ddlgen.DDLGenerator -Usa -Pmypassword -S192.123.13.111:5000 -Dmaster
</code></pre>

<p>Above command generate DDL for all database objects exist in user <code>sa</code>, also we get list of objects shared to other user by user <code>sa</code> as :</p>

<pre><code>Grant Select on dbo.mytable1 to anotheruserthansa
go
Grant Select on dbo.mytable2 to anotheruserthansa
go 
</code></pre>

<p>Now we want DDL of shared objects by username, like in my case user is <code>anotheruserthansa</code> </p>

<p>We need some command that can generate DDL for user, we might not have its password. <em>What we need to get DDL using my user sa, its password and with schema name : <code>anotheruserthansa</code> we need to generate ddl for all the database object those are shared by user <code>sa</code> to <code>anotheruserthansa</code></em>.</p>

<p>Like we do in <strong>Oracle</strong> with query : </p>

<pre><code>select  object_type from dba_objects where owner = ''anotheruserthansa' and object_name = 'anotheruserthansa'
</code></pre>

<p>How can we get DDL for shared object using its schema?</p>