How to get Current DB name and user in MS SQL server?

Most of the time I forget the command to get the DB name and current user when working. So decided to make post about it no better way to find the info fast.

Here are the 2 commands that basically gets the info.

  • Select DB_name() ;
  • Select Current_user;

Here is a post that my friend wrote on How to Insert Values into an Identity Column which I didn’t know to do before.

BTW he is Microsoft guy not CF :(

Related posts:

  1. Yahoo Power User
  2. How to identify and delete duplicate records from sql table

One Comment

  1. Balaji Kumaraguruparan
    Posted February 17, 2009 at 1:48 pm | Permalink

    In Oracle, We use

    Select * from v$database

    to retrieve database name.

    Select * from V$session

    to retrieve the current session user.

Post a Comment

Your email is never shared. Required fields are marked *

*
*