SQL SERVER – SQL Code Formatting 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 and I found two of the tools worth mentioning here.

SQL SERVER - SQL Code Formatting Tools codeformating-800x325

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

Both are good tools and still today after many years I use them. If you have come across any other such a great tool, please feel free to add to this blog post.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, , ,
Previous Post
SQL SERVER – Script/Function to Find Last Day of Month
Next Post
SQL SERVER – 2005 Build List Link

Related Posts

3 Comments. Leave new

Leave a Reply

Menu