Brian Biales

because blogging is just the easiest way to remember things

  Home  |   Contact  |   Syndication    |   Login
  23 Posts | 0 Stories | 25 Comments | 9 Trackbacks

News



Archives

Post Categories

.NET Development

Open Source and FOSS topics

Patterns And Practices

Web Development

Windows Administration

Tuesday, December 2, 2008 #

Ok, so this probably doesn't happen often, where some code doesn't know on what server or database it is operating on, but needs to know this information...  To be honest, I created this as I was able to logon to someone's DotNetNuke site as an admin, but did not have direct access to the website files.  The site owner asked where the database resided.  So I went to the Host->SQL menu option, which lets you run dynamic sql against your database.  And I typed this command in to discover the server and database name that DNN was using:

SELECT @@servername as ServerName, db_name() as DatabaseName

@@servername resolves to the name of the database server, and db_name() resolves to the "default" or current database.

Quite simple, I am posting it just in case someone else may find this useful some day.