How do I get a list of the tables, columns in the tables and the column attributes (like datatype, precision, etc..) in a SyBase database? I to be able to use sql commands to get this information like I can in Oracle.
ok i'm new and i tried ddlgen, it's useful, but right now i don't need it, i wanted to create a program through PB that will not use any outside programs and that will contain select statements that actually do what 'ddlgen' does, in short, a custom made 'ddlgen' type of utility, and the only problem i am experiencing is how to determine.....primary keys through systables...(sigh)
Here's an excerpt from a script for rebuilding clustered indexes to defrag tables. It gets the DRI bits for indexes.
@str_foreignkey_dri = isnull( substring('Y', 1, (1-abs(sign( (i.status2 & 1) - 1 ))) ), 'N'),
@str_primarykey_dri = isnull( substring('Y', 1, (1-abs(sign( (i.status2 & 2) - 2 ))) ), 'N')
id = object_id(@table_name)
and indid = 1
This will give you the foreign key and primary clauses for tables that use them. If you have defined your primary key indexes using create unique index or create unique clustered index, these bits will not be set. A unique index is not necessarilly the table's primary key, though a primary key constraint would enforce unqiueness.