Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
DrewBurlingame
Starting Member
49 Posts |
Posted - 2005-12-08 : 12:43:05
|
| Is there a way from within a script to get the name of the server, database and user for the current scope?I have a script that will vary slightly depending on which server and database it's run on, and another script that will vary based on the user that is logged in.Thanks,Drew |
|
|
DrewBurlingame
Starting Member
49 Posts |
Posted - 2005-12-08 : 15:17:11
|
| @@SERVERNAME gets the name of the server the script is running in.Any one have any ideas for databasename and user name?Thanks,Drew |
 |
|
|
nu_dba
Starting Member
8 Posts |
|
|
DrewBurlingame
Starting Member
49 Posts |
Posted - 2005-12-08 : 18:04:17
|
| Perfect. I knew they were there, I just couldn't remember the names of the functions. Thanks nu_dba. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-09 : 01:33:08
|
| AlsoSelect DB_name()select user_name()MadhivananFailing to plan is Planning to fail |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-12-09 : 14:46:36
|
| You coudl always look them up in books online |
 |
|
|
|
|
|