Geeks With Blogs
Brian Biales because blogging is just the easiest way to remember things

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.

Posted on Tuesday, December 2, 2008 1:03 PM | Back to top


Comments on this post: How to discover a SQL Server connection's Server and Database name

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Brian Biales | Powered by: GeeksWithBlogs.net