sybasesap-asesap-iq

list all tables from a database in syBase


In sql server 2012 i'm using

USE myDatabase;
GO
SELECT  *
FROM    sys.objects
WHERE   type = 'U';

Is it possible to do the same in syBase ?


Solution

  • In order to get a list of all tables in the current database, you can filter the sysobjects table by type = ‘U’ e.g.:

    select convert(varchar(30),o.name) AS table_name
    from sysobjects o
    where type = 'U'
    order by table_name
    

    Further Reference

    Here is an example of getting all table names in MSSQL or SQL Server database:

    USE test; //SELECT DATABASE
    SELECT table_name FROM information_schema.tables WHERE table_type = 'base table'
    

    or you can use sys.tables to get all table names from selected database as shown in following SQL query

    USE test; //SELECT DATABASE
    SELECT * FROM sys.tables
    

    That's all on how to find all table names from database in SQL Server.