Indenting code between BEGIN & END statements

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
rahulgarg7
Posts: 2
Joined: Tue 21 Aug 2012 17:19

Indenting code between BEGIN & END statements

Post by rahulgarg7 » Tue 21 Aug 2012 17:38

Hello, I have a couple of questions:

1) Do all the SQL complete settings get saved in the vssettings file maintained by SSMS or is there some separate file?

2) I was wondering if there was some option to indent the code between the BEGIN & END statements.

for eg, this is how I would expect to see all statements between the begin and end blocks below (please ignore that I'm using just select statements here).

Code: Select all

BEGIN TRY

	SELECT *
	FROM Categories

	SELECT *
	FROM Customers

	SELECT *
	FROM Orders 
			
END TRY
BEGIN CATCH
	PRINT 'error'
END CATCH
But when I format using SQL complete, this is how the sql gets formatted:

Code: Select all

BEGIN TRY

SELECT *
FROM Categories

SELECT *
FROM Customers

SELECT *
FROM Orders 
			
END TRY
BEGIN CATCH
	PRINT 'error'
END CATCH
Not really a biggie but is there some setting for this or is this something not possible to do using the various formatting options in SQL complete?

alexa

Re: Indenting code between BEGIN & END statements

Post by alexa » Wed 22 Aug 2012 10:42

1) Do all the SQL complete settings get saved in the vssettings file maintained by SSMS or is there some separate file?
SQL Complete settings are saved into a separate *.settings file. Please refer to the 'Import and Export Settings' node in dbForge SQL Complete Help documentation.
2) I was wondering if there was some option to indent the code between the BEGIN & END statements.
You could setup SQL Complete as below:

1. Select 'SQL Complete -> Options' from the main menu. The 'Options' window opens.
2. Navigate to the 'Formatting -> Indentation' branch.
3. Select the 'Indent block contents' option under the 'Code' node.

rahulgarg7
Posts: 2
Joined: Tue 21 Aug 2012 17:19

Re: Indenting code between BEGIN & END statements

Post by rahulgarg7 » Fri 24 Aug 2012 16:46

thanks for your response Alexa. Sorry for not replying earlier... I thought I would get some email notification when someone replied (but it seems I need to check the box specifically for that to happen...usually that is the default so I missed it).

Chris123
Posts: 8
Joined: Wed 04 Apr 2012 09:21

Re: Indenting code between BEGIN & END statements

Post by Chris123 » Fri 02 Aug 2013 13:45

Hi Alexa,

I have just updated to 4.0.89.1 of the Express Edition and this option seems to have disappeared from Formatting. I could not see a way of doing it in the Profiles settings either.

Can you please explain how BEGIN END block indenting can be achieved?

Thanks,

Chris

alexa

Re: Indenting code between BEGIN & END statements

Post by alexa » Mon 05 Aug 2013 07:42

Unfortunately, this feature is not available in the Express edition of dbForge SQL Complete. Therefore, we would recommend you to download a free trial version where all features are implemented in full: http://www.devart.com/dbforge/sql/sqlco ... nload.html

BradGreer
Posts: 1
Joined: Fri 25 Oct 2013 21:04

Re: Indenting code between BEGIN & END statements

Post by BradGreer » Fri 25 Oct 2013 21:17

alexa wrote:Unfortunately, this feature is not available in the Express edition of dbForge SQL Complete. Therefore, we would recommend you to download a free trial version where all features are implemented in full: http://www.devart.com/dbforge/sql/sqlco ... nload.html
I can appreciate not supporting some features in a free version. But could you please stop provide negative support for block formatting. If you don't support formatting in some context, just leave it alone rather than shoving it to the left margin and destroying my hard work of manual formatting. Destroying my formatting does not garner my respect or motivate me to pay you.

Post Reply