Formatting options, or bug?

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
dazzieb
Posts: 1
Joined: Wed 18 May 2011 13:58

Formatting options, or bug?

Post by dazzieb » Wed 18 May 2011 14:01

How do I setup my formatting options to change

Code: Select all

BEGIN
SELECT *
FROM a
BEGIN
SELECT *
FROM b
END
END
To

Code: Select all

BEGIN
  SELECT *
  FROM a
  BEGIN
    SELECT *
    FROM b
  END
END
I am using the latest version.

TIA
Darren

.jp
Devart Team
Posts: 345
Joined: Wed 09 Sep 2009 06:55
Location: devart

Post by .jp » Thu 19 May 2011 06:46

If you have dbForge SQL Complete Standard or Trial Edition, it's enough to turn the Place clause content on new line option (Options->Formatting->New Lines) off to get the kind of formatting you need. In this case formatting will be like the following:

Code: Select all

BEGIN
  SELECT *
  FROM a
  BEGIN
    SELECT *
    FROM b
  END
END
Also please pay attention to the fact that if you want to have two spaces before the select statement, you should set Tab size, Indent size - 2, Insert spaces – check in the MSSMS, Tools->Options->Text Editor->Transact-SQL->Tabs options.

If you have Express Edition, I should say that it supports only formatting of select, update, insert, delete statements. It means that Begin...end blocks will not be formatted, and the select statement will be formatted accordingly to your settings.

Post Reply