Oh thats the same as in MS-SQL then - I should have guessed as MS-SQL is 
actually microsofts version of sybase..

Thanks for the details though..

Cheers

Joe




________________________________
From: L G Robinson <[email protected]>
To: [email protected]
Sent: Wednesday, February 4, 2009 5:53:25 PM
Subject: Re: Trapping SQL error in an active link

Hi Joe,

I don't know much about the internal structures of an Oracle database,
but in Sybase, each database has a table called "sysobjects" and
information about tables is stored in there:

Name                          Owner                    Object_type
------------------------------ ------------------------ ------------
sysobjects                    dbo                      system table

Column_name    Type            Length
--------------- --------------- -----------
name            sysname                  30
id              int                      4
uid            int                      4
type            char                      2
userstat        smallint                  2
sysstat        smallint                  2
indexdel        smallint                  2
schemacnt      smallint                  2
sysstat2        int                      4
crdate          datetime                  8
expdate        datetime                  8
deltrig        int                      4
instrig        int                      4
updtrig        int                      4
seltrig        int                      4
ckfirst        int                      4
cache          smallint                  2
audflags        int                      4
objspare        int                      4
versionts      binary                  12
loginame        varchar                  30


By checking for the name and type = "U", I can test to
see if the table I want exists:

select @my_id = id from sysobjects where type="U" and name = "my_table"


The permissions are stored in a table called "sysprotects".

Name                          Owner                    Object_type
------------------------------ ------------------------ ------------
sysprotects                    dbo                      system table

Column_name    Type            Length
--------------- --------------- -----------
id              int                      4
uid            int                      4
action          smallint                  2
protecttype    tinyint                  1
columns        varbinary              133
grantor        int                      4


There may be multiple entries for a particular table if different
users/groups have been granted different types of access. In my
case, I needed to make sure that:

grant select on my_table to public

was in effect. So I look for that specifically in another select:

select action from sysprotects where id = @my_id AND action = 193

That part might be a little sketchy, but it is working.

Thanks again for all of the help.
Larry

On Feb 4, 2009, at 4:16 PM, Joe DeSouza wrote:

> **
> Hi Larry,
> 
> Glad it worked for you..
> 
> Just curious - what is the name of the Sybase equivalent system table that is 
> like the Oracles all_tables or user_tables?? That information might be useful 
> to me sometimes..
> 
> Cheers
> 
> Joe




_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: RMI Solutions ARSlist: "Where the Answers Are"

Reply via email to