FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Database Blog: SQL Prittifier
DATABASE
EXCEPTION::QUERY

A Blog About Database Products and Technology.

by Kevin Carlson
SELECT * FROM [Musings]

Database matters.

by Niklas Hemdal
July 14, 2006

SQL Prittifier

Red Gate has created a new program to pretty up SQL code so that it will display in a pretty way in an HTMP page. It is available as a Web application, here.

Here is an article describing the product, and it's limits.

The program works pretty well. The resulting HTML is a little verbose, but when you need to print some SQL code on a Web page, it is very useful. For instance, this code has been prettified:

ALTER PROCEDURE dbo.spQueryUserIsInRole

       
@EMail NVARCHAR(128),
       
@RoleName NVARCHAR(128)
AS
       SET 
NOCOUNT ON 
       DECLARE 
@UserID INT
       DECLARE 
@RoleID INT
       DECLARE 
@Ret INT
       
       SET 
@Ret=0
       
       
SELECT TOP @UserID=UserID 
               
FROM [User]
               
WHERE Email=@EMail
       
       
SELECT @RoleID=RoleID FROM Role WHERE RoleName=@RoleName
       
       
IF EXISTS(SELECT FROM UserRoleLink WHERE UserID=@UserID AND RoleID=@RoleID)
       
BEGIN
               SET 
@Ret=1
       
END
       
       SELECT 
@Ret AS Ret
       
       
RETURN @Ret

Posted by Douglas Reilly at 08:17 AM  Permalink




 
INFO-LINK