How to figure out what DB instance you are using when using isql (Sybase)

Today a coworker taught me how to figure out what database instance I am using when using the isql command line tool connecting to Sybase. This involves two query statements:

select dbid from master..sysprocesses where spid = @@spid

The above statement will display the dbid of the database instance you are using. Next using this dbid to find out the name:

select name from master..sysdatabases where dbid = [dbid]

Thanks to Bob for this cool trick! :)

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s