How to check which Database is a current database?

 Posted by vishalneeraj-24503 on 12/11/2013 | Category: Sql Server Interview questions | Views: 2397 | Points: 40
Answer:

With the help of DB_NAME() in-built Sql-Server function,we can check which DB is currently selected.

Below is a query to check DB:-
SELECT DB_NAME() AS [Current Database];


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response