Formatting stored procedure in SQL Server 2014?

Formatting stored procedure in SQL Server 2014?

Code Formatting in Stored Procedure on any version of SQL Server:

With the Editor you can format your code with indenting, hidden text, URLs, and so forth. You can also auto-format your code as you type by using Smart Indenting.

Indenting

You can choose three different styles of text indenting. You can also specify how many spaces compose a single indentation or tab, and whether the Editor uses tabs or space characters when indenting.

Formatting stored procedure in SQL Server 2014?

To choose an indenting style:

1.     On the Tools menu, click Options.

2.     Click Text Editor.

3.     Click the folder, and select All Languages to set indenting for all languages.

4.     Click Tabs.

5.     Click one of the following options:

o   None. The cursor goes to the beginning of the next line.

o   Block. The cursor aligns the next line with the previous line.

o   Smart (Default). The language service determines the appropriate indenting style to use.

To change indent tab settings:

1.     On the Tools menu, click Options.

2.     Click Text Editor.

3.     Select the folder for All Languages to set indenting for all languages.

4.     Click Tabs.

5.     To specify tab characters for tab and indent operations, click Keep tabs. To specify space characters, select Insert spaces.

If you select Insert Spaces, enter the number of space characters each tab or indent represents under Tab Size or Indent Size, respectively.

To indent code:

1.     Select the text you want to indent.

2.     Press TAB, or click the Indent button on the Standard toolbar.

To unindent code:

1.     Select the text you want to unindent.

2.     Press SHIFT+TAB, or click the Unindent button on the Standard toolbar.

To automatically indent all of your code

1.     On the Tools menu, click Options.

2.     Click Text Editor.

3.     Click All Languages.

4.     Click Tabs.

5.     Click Smart.

To convert white space to tabs:

1.     Select the text whose white space you want to convert to tabs.

2.     On the Edit menu, point to Advanced, and click Tabify Selection.

To convert tabs to spaces:

1.     Select the text whose tabs you want to convert to spaces.

2.     On the Edit menu, point to Advanced, and click Untabify Selection.

The behavior of these commands depends on the tab settings in the Options dialog box. For example, if the tab setting is 4, Tabify Selection creates a tab for every 4 contiguous spaces, and Untabify Selection creates 4 spaces for every tab.

Converting Text to Upper and Lower Case

You can use commands to convert text to all uppercase or lower case.

To switch text to upper or lower case:

1.     Select the text you want to convert.

2.     To convert text to uppercase, press CTRL+SHIFT+U, or click Make Uppercase on the Advanced submenu of the Edit menu.

3.     To convert text to lowercase, press CTRL+SHIFT+L, or click Make Lowercase on the Advanced submenu of the Edit menu.

Displaying and Linking to URLs

You can create and display clickable URLs in your code. By default, the URLs:

·       Are underlined.

·       Change the mouse pointer to a hand when you move over them.

·       Open the URL when clicked, if the URL is valid.

To display a clickable URL:

1.     On the Tools menu, click Options.

2.     Click Text Editor.

3.     To change the option for only one language, click that language folder and then click General. To change the option for all languages, click All Languages and then click General.

4.     Select Enable single-click URL navigation.




You may also like

No comments:

If you have any queries regarding the article or in performing something in Microsoft SQL Server then please let me know.