View or Table
Posted in 1999
Topics: General Discussion
Hi, I am new in Informix , and want tu ask : I have a table and I want to know if a table is table or view. :) I do not know the script that was a table created. Is there any method to find out this ? thanx Roman
You can check it in the systables table.
Systables table describes each table in the database.
It contains one row for each table, view or synonym defined.
Systables has a column (tabtype) and returns 'T' for table,
'V' for view, 'S' for synonym or 'L' for log.
select tabname, tabtype
from systables
where tabname = '?' -- the name of your table/view.
Another method is by using dbschema. dbschema generates
the SQL statements of your database/tables.
The syntax is:
$ dbshema -d dbname -t tablename
Roman.Smatana@socpoist.sk wrote in message
<7staf7$2rm$1@news.xmission.com>...
>
>
> Hi,
>
> I am new in Informix , and want tu ask :
>
> I have a table and I want to know if a table is table or view. :)
> I do not know the script that was a table created.
>
> Is there any method to find out this ?
> thanx
>
> Roman
>
Select the tabtype from systables or run:
dbschema -d <database> -t <table-or-view>
which will printout the SQL DDL needed to recreate the object which will
either be a CREATE TABLE or CREATE VIEW statement.
Art S. Kagel
Roman.Smatana@socpoist.sk wrote:
>
> Hi,
>
> I am new in Informix , and want tu ask :
>
> I have a table and I want to know if a table is table or view. :)
> I do not know the script that was a table created.
>
> Is there any method to find out this ?
> thanx
>
> Roman
Try this:
select tabname, case when tabtype = "V" then "is a view"
else "is not a view"
end
from systables
where tabname = "your_table_or_view_name_within_quotes"
Only if you have the latest version of IDS, the case construct will work.
Otherwise you can just do
select tabtype from systables
where tabname = "your_table_or_view_name_within_quotes"
If the output is V then it is a view.
Senthil Kumar
Roman.Smatana@socpoist.sk wrote in message <7staf7$2rm$1@news.xmission.com>...
>
>
> Hi,
>
> I am new in Informix , and want tu ask :
>
> I have a table and I want to know if a table is table or view. :)
> I do not know the script that was a table created.
>
> Is there any method to find out this ?
> thanx
>
> Roman
>