question

shalabh21 avatar image
shalabh21 asked

SQL SCRIPT FORMATTER

Hi All, Warm wishes from shalabh saxena. I want to make a SQL script formatter using C#,ASP DOT NET. Can any one give me breif idea about this. Fairly say i do not know much about this even how to start on this. i just have good knowledge of C#, ASP DOT NET and SQL 2008. Please give me clear idea.
sqlt-sqlc#
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image
Grant Fritchey answered
There are already a number of tools out there that do this. You might want to take a look at them. There's [SSMS Tools Pack][1], [TSQL Prettifier][2], and my company's product, [SQL Prompt][3]. I think there are a couple of others as well. The first two in the list are free. [1]: http://www.ssmstoolspack.com/ [2]: http://extras.sqlservercentral.com/prettifier/prettifier.aspx [3]: http://www.red-gate.com/products/sql-development/sql-prompt/
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shalabh21 avatar image shalabh21 commented ·
Hi Grant, Thanks for response. actualy i want to make create my own tool. so for this i requrire some intiall help from your side guys... so if any one give me some brief idea it will much appriciated.
0 Likes 0 ·
hemanth.damecharla avatar image
hemanth.damecharla answered
I am not sure why you would want to attempt such a complex task but, if you are still going to do it anyways, then the starting point would be to parse the given SQL and validate that it is correct and then tokenize it into keywords. I did a quick google search and found the following links: [Google][1] [CodeProject][2] [Devioblog][3] [1]: http://www.google.co.in/#sclient=psy-ab&hl=en&source=hp&q=sql+parser+c%23&pbx=1&oq=sql+parser+c&aq=1&aqi=g2g-v2&aql=&gs_sm=3&gs_upl=0l0l1l375l0l0l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=ddbe45f2069e114c&biw=1440&bih=719 [2]: http://www.codeproject.com/Articles/32524/SQL-Parser [3]: http://devio.wordpress.com/2009/06/29/parsing-sql-into-xml-and-c-objects/
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shalabh21 avatar image shalabh21 commented ·
Hi Hemanth, actaully i want to do some thing special for my company in and some innovative
0 Likes 0 ·
Pavel Pawlowski avatar image Pavel Pawlowski commented ·
Hi, I think you will not receive much help from here as this site is related to the SQL Server and not the General Development. AS @hemanth.damecharla mentioned, you should take a look on sites like Code Project, Stack Overflow etc. To achieve really good formatting, it's quite complex task.
0 Likes 0 ·
shalabh21 avatar image shalabh21 commented ·
thanks pavel...
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.