Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Auto format TSQL Tool?

Author  Topic 

cipher
Starting Member

10 Posts

Posted - 2007-09-20 : 10:03:26
we have a lot of TSQL stored procedure code that we are helping a client update. Unfortunately, we don't have copies of their original scritps and are having to pull this logic directly from the database. The problem is that these procs have no formatting and the TSQL is coming out as long strings, making it hard to debug and time-consuming to properly format.

Is there any tool out their that will automatcally format the TSQL code for you?

For example, given the following...

create procedure myProc @par1 bit AS if par1 = 1 begin return 'True' else return 'False' end

We would like something closer to...

create procedure myProc
@par1 bit
AS

if par1 = 1
begin
return 'True'
else
return 'False'
end

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-09-20 : 10:09:46
Try

www.sqlinform.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-09-20 : 10:10:00
Have you tried right-clicking the sproc in SMS and choosing either "Modify" or "Script Procedure As". That will give you a nice format, unless the original script was just plain ugly.

Jim
Go to Top of Page

cipher
Starting Member

10 Posts

Posted - 2007-09-20 : 21:28:17
madhivanan, thank you very much.
Go to Top of Page

deviprasad
Starting Member

5 Posts

Posted - 2011-12-28 : 07:38:08
you can use the following link:
[url]http://sqlserverlearner.com/online-tools/tsql-code-formatter[/url]

Thanks,
Devi Prasad
Learn SQL Server
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2011-12-28 : 13:58:34
I use SQL Assistant from SoftTree Technology (http://www.softtreetech.com/). The formatting is fully customizable to your format - however, the utility is not free.

Jeff
Go to Top of Page
   

- Advertisement -