Tuesday, 29 March 2016

How to get the ID of the selected database in SQL server ?

To get the ID of the selected database refer the following syntax 

Syntax:

DB_ID()

Example:

SELECT DB_ID()

Output:

5

Open a new query window ,select the required database and Now execute the above function,then you will get the ID of the selected database.

No comments:

Post a Comment