SQL Syntax Highlighter
HTML format your SQL commands.
Name: SQL Syntax Highlighter
Version: V3.0
Size: 5 KB
Written: March 03, 2004
Updated: February 08, 2005
Download

The first version used a bunch of split commands, the second used a loop to cycle through each character, and the third and current version uses regular expressions.

SQL Syntax Highlighter is an ASP class which takes a plain-text SQL statement and transforms it into HTML with syntax highlighting. Version three of this code works better than ever, is more reliable, and handles more complicated SQL statements, simply because the code now uses regular expressions. Version three also introduced special formatting for Microsoft Access style dates -- #02/14/2005#.

Sample code useage:

<!--#include file="sql_color3.asp"-->
<%
'Create the SQLSyntaxHighlighter object
Dim SQLColor
Set SQLColor = new SQLSyntaxHighlighter
Response.Write(SQLColor.Highlight("SELECT * FROM tblNames WHERE firstname <> 'John' "))
'Clean up
Set SQLColor = Nothing
%>

Sample code output:

SELECT * FROM tblNames WHERE firstname <> 'John'