📜 ⬆️ ⬇️

MS SQL 2011 - new in SSMS

One of the most interesting and exciting developments from Microsoft in terms of technology was presented on November 8, 2010. On this day, the release of CTP 1 SQL Server 2011 (Codename Denali) took place. CTP is available in both x86 and x64. As expected, the new server brought a lot of tasty for all MS SQL fans, be it a developer, administrator or business analyst.

Over the past few years, Microsoft has implemented many interesting technologies that have been adopted by developers. The most significant changes were made in the 2005 SQL Server and received additional development in the 2008 edition. This article ( final ) will look at the changes and new features that have occurred in the new version of SQL Server.

If you have any problems installing the server, I recommend referring to this article .
Next, we will talk about innovations in SQL Server Management Studio (SSMS).

Launch


After logging on to the server, a new shell will appear to your gaze, now completely on WPF.

')
Before creating a new database, make sure that compatibility is set on SQL Server “Denali” (110).


SSMS improvements


SQL Server Management Studio, as I noted earlier, is now completely on WPF and got all the pros and cons of Visual Studio 2010.
Now you can more flexibly customize the location of windows.




Cyclic clipboard is supported. This functionality has migrated straight from the studio.


Added support for the task list . You can create tasks and assign them priority. You can reach them through the menu View> Task List or by pressing Ctrl + \, T. Task list:


Assign priority to a task:


Closing a task:


In the code editor you can now use the increase / decrease text .



Snipples


Finally, snippets appeared in the studio for enclosing a block of code into various control sequences: IF, WHILE, Begin ... End.


Imagine that we have such a simple script:
Declare @i int set @i = 0 print @i set @i += 1 

Now, if we want to use a loop, you can use snippets and get rid of manual work. Profit!

1. First you need to select a piece of code that is going to be framed with a control sequence.


2. Then you can call the context menu Surrounded With or press Ctrl + K, Ctrl + S.



3. The last step will be a double click on While and the code will be generated!


It remains only to set the conditions and run the script.

Those. we get almost ReSharper for the database. Further more!

Intellisense


Tips and opportunities for autogenerating scripts from templates will work in the same way. They can be called from the menu Edit> IntelliSense> Insert Snippet or by the combination Ctrl + K, Ctrl + X


If you need to insert a table, just double-click or press Enter at the desired point.


This code will be generated:


Creating your own snippet


However, if the convenience of use approaches good, then creating snippets still leaves much to be desired. Compared to the same process in ReSharper.

For example, create a snippet to the already considered Sequence object.

First of all, you will need to create a file with a snippet code and save it in any non-random location. The file must have an extension . snippet , follow a well-defined XML schema.
 <?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0">   <Header>     <SnippetTypes>       <SnippetType>Expansion</SnippetType>     </SnippetTypes>     <Title>Sequence</Title>     <Author>Niladri Biswas</Author>     <Description>Code snippet for Sequence Creation</Description>     <HelpUrl>http://msdn.microsoft.com/en-us/library/ff878091(v=sql.110).aspx</HelpUrl>     <Shortcut></Shortcut>   </Header>   <Snippet>     <Code Language="sql">                      <![CDATA[                CREATE SEQUENCE Sample_Sequence                        START WITH 1               INCREMENT BY 1               MINVALUE -2147483648               MAXVALUE 2147483647                             ]]>   </Code>   </Snippet> </CodeSnippet> </CodeSnippets> 

Suppose you saved the file in C: \ CustomSequence \ CustomSequence.snippet. Now you will need to register it in the snippet manager.

In SQL Server Management Studio, select Tools> Code Snippet Manager or press Ctrl + K, Ctrl + B , after which the manager window will appear:


Click on Add ... to add our file. After that, it will appear in the CustomSequence node. After that, you can close the window.


You can call a new snippet as already described using Tools> Code Snippets Manager or using the combination Ctrl + K, Ctrl + B.


Double-click on the following code:
 CREATE SEQUENCE Sample_Sequence START WITH 1 INCREMENT BY 1 MINVALUE -2147483648 MAXVALUE 2147483647 

More useful may be the option to import snippets into Code Snippet Manager and use the Snipet Designer with CodePlex. Hands to write snippets are not at all interesting.

More on the topic


  1. SQL Server Denali - New Features
  2. First look at SQL Server Management Studio
  3. SQL Server v.Next (Denali): The New SSMS


At the moment, this is all about SSMS functionality and TSQL innovations. The author can see an article of considerable size about improvements in SSIS, a lot of pictures, unfortunately not the best quality. Almost like this article.

Transfers from the cycle:
MS SQL Server 2011: Autonomous databases , new Sequence object , Offset operator , error handling , With Result Set construction .

Source: https://habr.com/ru/post/123664/


All Articles