Turn Management Studio Into A Web Browser
First of all I can’t take credit for this. The credit for what I’m about to show you comes courtesy of Steve Jones and the crew of 1,000s over at SQLServerCentral. When I stumbled across this today I felt like Charlie Sheen on a bender in Amsterdam.
What am I talking about? Well, it’s about turning SQL Server Management Studio into a web browser and enhancing your Transact-SQL documentation all in one.
Most DBAs I know create stored procedures, functions, and perform other custom T/SQL coding. Some of us (the good little boys and girls) even document our code. Not too many of enhance our documentation with links to supporting information though. The March 24, 2010 Question of The Day (QOTD) on SSC.com raised the question of what happens when a hyperlink is displayed inside of T/SQL in the Query window within SSMS. The result was surprising and I won’t spoil the fun other than to say give it a shot by pasting the function code below into a new query window in SSMS. The function itself is something I created and wrote about on MSSQLTips.com quite recently. Please be sure to check out their site while there.
--****************************************************-- ---------Author: Timothy Ford --------- --------- http://thesqlagentman.com --------- -- returns nvarchar (4000) = dbo.fn_SQLServerBackupDir() --------- For more information check out --------- /* http://www.mssqltips.com/tip.asp?tip=1966 */ --****************************************************-- IF OBJECT_ID('dbo.fn_SQLServerBackupDir') IS NOT NULL DROP FUNCTION dbo.fn_SQLServerBackupDir GO CREATE FUNCTION dbo.fn_SQLServerBackupDir() RETURNS NVARCHAR (4000) AS BEGIN DECLARE @path NVARCHAR (4000) EXEC master.dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer',N'BackupDirectory', @path OUTPUT, 'no_output' RETURN @path END;