How can I get sqsh to tell me which tables are available?
Asked
Active
Viewed 2.8k times
4 Answers
9
Does sp_tables
work for you? Are you trying to get tab completion when creating a query?

brianegge
- 29,240
- 13
- 74
- 99
6
After some help from this site and some trial and error:
select table_name from systable
go
Painfully enough, sp_help
doesn't exist in my version.

rampion
- 87,131
- 49
- 199
- 315
-
1This seems to be specific for a certain Sybase version as it doesn't work on ASE. Are you using IQ? – VolkA Apr 22 '13 at 09:10
5
Newer version use sysobjects:
SELECT name FROM sysobjects WHERE type = 'U';
Regards,

user1126070
- 5,059
- 1
- 16
- 15
2
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

Paul Harrington
- 772
- 4
- 9