[How To]   [Notes]   [Links]  


How To


How to list available SQL servers
go to the DBA Host Database Search web page

How to start an interactive SQL session from Unix
There are two tools: isql and sqsh. isql may already be available to you. If sqsh is not available, you can get a copy from either cmtools or .
  • From isql:
    $ isql -S server_name -U user_name
    Password:
  • From sqsh:
    $ sqsh -S server_name -U user_name
    Password:

How to change your password
1> sp_password old_password,new_password
2> GO

How to list available databases
1> SELECT name FROM master..sysdatabases
2> GO

How to select a database
1> USE database_name
2> GO

How to list non-system tables in the database
1> SELECT name FROM sysobjects WHERE type='U'
2> GO

How to list non-system-table objects in the database
1> SELECT name, type FROM sysobjects WHERE type<>'S'
2> GO

How to list the column names of a table
1> SELECT c.name
2> FROM syscolumns c, sysobjects o
3> WHERE o.name="table_name"
4> AND o.id = c.id
5> GO

How to list the column names of a table with data type (and some other junk)
1> sp_help table_name
2> GO

How to specify a row limit to the output from a SELECT statement
1> SET ROWCOUNT 20
2> GO
1>

How to list stored procedures in the database
1> SELECT name FROM sysobjects WHERE type='P'
2> GO

How to display a stored procedure
1> sp_helptext stored_procedure_name
2> GO

How to edit the last command
  • To invoke a text editor to edit the last command:
    You must specify what editor you want to use either by setting the EDITOR environment variable or by specifying it on the Unix command line, e.g., isql -E emacs
    Then you just enter the editor name at the isql prompt:
    1> emacs
  • If you're using sqsh, then you can use the previous technique or you can use your up and down arrow keys to recall previous commands and left and right arrow keys to move the cursor within commands to edit them.

How to abort the entry of a command
1> SELECT c.name
2> FROM syscolumns c, sysobjects o
3> WHERE o.name="table_name"
4> AND o.id = c.id
5> reset
1>

How to get out of the database
1> QUIT
or
1> EXIT

Notes

  • On Unix, the Sybase interfaces file is at path $SYBASE/interfaces. On Windows its path is C:\Sybase\ini\sql.ini, however, it is updated through the dsedit utility.

Links

DBArtisan
sqsh (SQL Shell Home Page)
AOL Sybase Database Administration
Ordering Documentation
Request Sybase Interfaces File Update
Sybase home page
Sybase Online Manuals (see Adaptive Server IQ links for SQL info)
Sybase Utilities (isql, bcp, dsedit, etc.)