How can I get sqsh to tell me which tables are available?
What's the equivalent of "Show Tables" in SQSH
27.7k Views Asked by rampion At
4
There are 4 best solutions below
1

I am not familiar with systables. What flavor of Sybase are you running? ASA perhaps?
Please find appended a sqsh function (which you can put in your .sqshrc) which demonstrates some querying of the ASE (Adaptive Server Enterprise) catalog tables and the use of the Ed Barlow system stored procedure library http://www.edbarlow.com/gem/procs_only/index.htm to figure out what objects are in a database.
# Shorthand for sp__helptext or sp__revtable \func -x ? IF EXISTS (SELECT * FROM sysobjects WHERE name = \\'${1}\\') BEGIN DECLARE @type VARCHAR(3) SELECT @type = type FROM sysobjects WHERE name = \\'${1}\\' IF @type IN (\\'U\\') exec sp__revtable ${1} ELSE exec sp__helptext ${1} END ELSE -- default to sp__ls (which can list partial matches) if an exact match wasn't found in sysobjects exec sp__ls ${1} go \done
After some help from this site and some trial and error:
Painfully enough,
sp_help
doesn't exist in my version.