This is a discussion on Connected to which database within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello all, I have a scripts which needs the information about the database in which it is running. How ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello all, I have a scripts which needs the information about the database in which it is running. How can I find out this information. For example if I want to know the User who has satrted this report, I use the SYSTEM_USER procedure. Does an equal procedure exist to find out, on which database the user is connected to. Regrads Franz-Josef |
| ||||
| You can the name of the current database with DB_NAME(): SELECT DB_NAME() -- Hope this helps. Dan Guzman SQL Server MVP "Franz-Josef" <Post@tophoven.net> wrote in message news:a0fd39b2.0404280302.403618ee@posting.google.c om... > Hello all, > > I have a scripts which needs the information about the database in > which it is running. > > How can I find out this information. > > For example if I want to know the User who has satrted this report, I > use the SYSTEM_USER procedure. > > Does an equal procedure exist to find out, on which database the user > is connected to. > > Regrads > Franz-Josef |
| Thread Tools | |
| Display Modes | |
|
|