How to find the current Database you are using with a query in SQL Server
By Santhosh N
This explains how to find the current Database name in SQL Server
While working with multiple databases in the application and to get the database
name from within the query (may be from within the Stored Procedure), you can
use this simple query to find the Database name
SELECT DB_NAME() AS DBName
Related FAQs
This explains the advanced query tuning concepts of the SQL Server in terms of using joins
This explains about the Parameters passing to the stored procedures in Sql Server.
This explains how to use TEMP tables in the SELECT query for better query performance.
This explains how to set DEADLOCK_PRIORITY in SQL Server and its benefits in doing so.
This explains the best scenarios to create CLUSTERED index on the table in SQL Server.
This explains about the creation of NON-CLUSTERED indexes and maximum allowed.
How to find the current Database you are using with a query in SQL Server (1121 Views)