db_id  degrees

Chapter 2: Transact-SQL Functions

db_name

Description

Returns the name of the database where the ID number is specified.

Syntax

db_name([database_id])

Parameters

database_id

is a numeric expression for the database ID (stored in sysdatabases.dbid).

Examples

Example 1

Returns the name of the current database:

select db_name()

Example 2

Returns the name of database ID 4:

select db_name(4)

------------------------------ 
sybsystemprocs

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute db_name.

See also

Functions col_name, db_id, object_name





Copyright © 2005. Sybase Inc. All rights reserved. degrees

View this book as PDF