SQL SERVER – SQL Code Formatter Tools

SQL Code Formatting is very important. Every SQL Server DBA has its own preference about formatting. I like to format all keywords to uppercase. Following are two online tools, which formats SQL Code very good. I tested following script with those tools.

use tempdb
go
create procedure SP_NonFatal_INSERT @Column2 int =NULL
AS declare @ErrorMsgID int insert NonFatal
values (@Column2) set @ErrorMsgID =@@ERROR
if @ErrorMsgID 0 BEGIN
RAISerror (‘An error occured updating the NonFatal table’,10,1) end
GO

Tool 1 : Instant SQL Formatter
USE TEMPDB
GO

CREATE PROCEDURE sp_NONFATAL_INSERT
@Column2 INT = NULL
AS
DECLARE
@ErrorMsgID INT
INSERT
NONFATAL
VALUES(@Column2)
SET @ErrorMsgID =@@ ERROR
IF @ErrorMsgID 0
BEGIN
RAISERROR
(‘An error occured updating the NonFatal table’,10,1)
END

Tool 2 : SQLinForm
USE tempdb GO
CREATE PROCEDURE
sp_NonFatal_INSERT @Column2 INT =NULL
AS
DECLARE
@ErrorMsgID INT
INSERT
NonFatal VALUES (@Column2) SET @ErrorMsgID =@@ERROR
IF @ErrorMsgID 0
BEGIN
RAISERROR
('An error occured updating the NonFatal table',10,1)
END

Reference : Pinal Dave (http://blog.SQLAuthority.com)

About these ads

5 thoughts on “SQL SERVER – SQL Code Formatter Tools

  1. Pingback: Cloudy Thinking Blog Archive Pinalkumar Dave on Two SQL Pretty Printing Tools

  2. Pingback: SQLAuthority News - Best Articles on SQLAuthority.com Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s