18

syntax highlighting + sql code format

idiotgenius
  • 499
  • 2
  • 9
  • 21

4 Answers4

28

Code Mirror will do the trick. It's really nice. Very easy to run any code that you enter into it using editor.getValue().

Zevan
  • 10,097
  • 3
  • 31
  • 48
  • http://codemirror.net/contrib/sql/index.html – mpen Jan 03 '11 at 07:06
  • it's right for me thanks Zevan – idiotgenius Jan 04 '11 at 01:21
  • 3
    I ended up using a combination of [Hibernate's SQL Formatter](http://stackoverflow.com/a/4873441/148631) and Code Mirror to display formatted, syntax highlighted SQL on a web page. I do the formatting on the server side and then code mirror does the syntax highlighting. This is because Code Mirror's SQL plugin can do syntax highlighting but not formatting – Puneet Jul 26 '12 at 00:29
  • 1
    This is the perfect solution – Ercan ILIK Jul 18 '19 at 19:24
2

You could try http://www.dpriver.com/pp/sqlformat.htm

It doesn't format on the fly, but it does highlight and format your SQL when you submit the form.

Ben H
  • 3,136
  • 3
  • 25
  • 34
1

you can try following site for online formatting

http://www.sqlinform.com/free_online_sw.html

http://sqlformat.appspot.com/

OR

you can download free SSMS free plugin for offline which gives you formatting along with intelli sense support from

http://www.devart.com/dbforge/sql/sqlcomplete/

Shyam
  • 21
  • 2
-1

use can also you Antlr javascript framework http://www.antlr.org/

krish at
  • 89
  • 1
  • 4