SK9
SK9

Reputation: 87

SP_Who does not return DBName Column

My Delphi application connects to a SQL Server Database through BDE.
In the process, my application queries SP_Who stored procedure to get the DbName column Value. But now I want to connect my application through ODBC to the SQL Server database.

I'm using the SQL Server Native client driver for this, but when my application queries SP_Who but the procedure does not return the DBName Column. Why is this? How can I get the value of DBName in this case? Is there any other procedure to obtain the DBName column value.

Upvotes: 1

Views: 713

Answers (1)

Mitch Wheat
Mitch Wheat

Reputation: 300719

You can obtain the database name using:

SELECT DB_NAME()

Do you get the DBName column running sp_who2 ?

Upvotes: 3

Related Questions