最近写了一些SQL,数据库用的是MS-SQL,而SQL Server ManagementStudio是不自带代码格式化功能的,这让我用起来很郁闷,PL/SQL Developer格式起来多爽啊。
在网上找了一下SQL格式化工具,只有一个用起来还不错的在线版本,我测试了一下,功能强大,可惜不支持中文,注释的中文会被打上??
SQL Pretty Printer
我在那个在线网站看到了Desktop Version的菜单,进去一看,哦,原来这个网站本身就在做一款SQL格式化工具的产品,叫做 SQL PrettyPrinter。
SQL Pretty Printer 的桌面版本
格式化好之后的代码
功能
SQL Pretty Printer目前提供4种使用方式,桌面版本,SSMS(SQL Server ManagementStudio)插件,VS插件,和提供API接口。
SSMS(SQL Server Management Studio)插件版本
可以将SQL转化成代码格式,支持数种语言
可以将SQL转化成HTML格式
获取
使用版本只能提供30次,而且桌面版本的无法将代码复制出来,我使用的是SSMS插件版本,可以直接在查询器里面格式化,试用版的限制比较多。
翻遍SQL Pretty Printer的网站,终于发现了Get SQL Pretty Printer Desktop Version ForFree信息,作者说可以通过4种途径获取免费的授权码。
1.If you are a technical/software blogger or journalist willing to writeus up (honest reviews are the most useful to us) email us a short blurb with the link to your blog and we'll send youa license, FREE of charge, so that you can evaluate sql pretty printerproperly.
2.If you are willing to demo SQL Pretty Printer to an audience of atleast 15 people (at a user group, a conference, a BarCamp), email usyour info and we'll give you two licenses, one for you to keep and one to giveaway at the event, FREE of charge.
3.If you teach a high-school class, emailus the name ofyour school and your class, plus the number of students in your class. We willsend you a license for all of them.
4.A note to university students and professors: we currently do notoffer free licenses to universities, but we'll be happy to offer you anadditional 50% off any orders of 10 or more licenses. Let usknow if you'reinterested and we'll set up a discount code for you.
很幸运,我有自己的软件博客,写完这篇文章之后,我就会向作者发出申请邮件。
最后
说说这个软件的弊病吧,那就是功能太单一。现在大部分的查询器都有格式化功能,只是M$这边没有加入这个功能,从该软件的产品线来看,很依赖于SSMS和VS,一旦他们加入格式化功能,这个软件的使用价值就大大降低了。
Links
下载链接:http://www.dpriver.com/dlaction.php
在线版本(不支持中文):http://www.dpriver.com/pp/sqlformat.htm
获取免费的授权码:http://www.dpriver.com/products/sqlpp/getforfree.php
3a1ff193cee606bd1e2ea554a16353ee