Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Database name of sqlserver [duplicate]

Tags:

sql

sql-server

How to get Database name of a specific Database in a stored procedure.

like image 953
Sreekumar P Avatar asked Jul 21 '11 10:07

Sreekumar P


People also ask

How do I find the server name in SQL Server query?

Step 1 -Open a command prompt window on the machine in which SQL is installed. Go to Start → Run, type cmd, and hit enter to open the command prompt. Step 2 -SQLCMD -S servername\instancename (where servernameb= the name of your server, and instancename is the name of the SQL instance). The prompt will change to 1→.

What is database cloning in SQL Server?

Database cloning is the process of creating a point-in-time copy of a production database or its backup set.


1 Answers

To get the current database name use select db_name().

DB_NAME(Transact-SQL)

like image 171
Mikael Eriksson Avatar answered Oct 08 '22 02:10

Mikael Eriksson