Web page listing SQL code

  • Hi,

    I'm building a web page for my users that will list example SQL scripts but would like to retain the SQL coding colours and font used from SSMS. Or do have to slog it out by specifying fonts etc.

    Is there an easy way to code that using html ?

    Any ideas would be great.

    Thanks,

    Eamon

     

     

     

  • To format the SQL on-the-fly, search for 'syntax highlighter'. One I've used is the open-source GeSHi tool (https://en.wikipedia.org/wiki/GeSHi), although its T-SQL coloring was last publicly updated a while ago. You can easily modify the reference file for T-SQL; the list of keywords, DMVs, etc. for each color are just arrays in the file that you can add any new items to in a text editor. There are syntax-highlighter plugins for many blog/wiki/etc. platforms.

    If you're creating static HTML pages and just want to mark up the SQL to look good on the page, there are a variety of online sites, such as http://www.dpriver.com/pp/sqlformat.htm that let you paste your SQL in a box and it gives you the marked-up HTML. Search for 'SQL Server pretty print'.

    Eddie Wuerch
    MCM: SQL

  • curious on this one ---- has no-one ever come up with a CSS style for SQL code that is vaguely acceptable?

    MVDBA

  • in my searches - http://hilite.me/

    not too bad

    MVDBA

  • Hi,

    thanks everyone for the great advice and after looking at what's on offer I decided to go for a low cost cheap and possibly lazy method which is creating what I need in Word and saving it in HTML format. I've tested it and it works fine for me.

    It was a single page with an index at the top pointing to SQL code which I needed.

    Thanks again for your help,

    Eamon

  • ps....a CSS for SQL code would be amazing !!!

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply