Skip to main content

SQL Server 2012: New Features for Developers

Just few days back I have started to work with SQL Server 2012, here I am writing about some of the new features of SQL Server 2012.

SQL Server 2012 does not come with earth-shaking changes but comes with performance improvements, feature improvements and some new features. SQL Server 2012 also brings many new features to the T-SQL language, some of them are listed in this post.

SQL Server Management Studio 2012: SSMS 2012 packs a number of powerful productivity benefits that developers who use SSMS for development tasks will end up loving.  The most obvious change is to Management Studio is that it’s built on Visual Studio 2010(and it has same theme as in figure.) and has the same engine as Visual Studio which means you get a nice WPF experience, better font rendering and CTRL-scroll quick zoom-in/zoom-out.

Being built on Visual Studio 2010 also means that SSMS 2012 picks up Visual Studio 2010's vastly improved multi-monitor support.
SSMS 2012 inherits Visual Studio's Clipboard buffer. This means that you can cycle through previously copied text by holding down the Shift key while pressing Ctrl+V.

Columnstore Indexes: This is a cool new feature that is completely unique to SQL Server. They are special type of read-only index designed to be use with Data Warehouse queries. Basically, data is grouped and stored in a flat, compressed column index, greatly reducing I/O and memory utilization on large queries.

TRY_CONVERT(): TRY_CONVERT is new T-SQL function which returns a value cast to the specified data type if the cast succeeds; otherwise, returns null. You can explore detailed description and example in this post.

Paging : Paging got simpler with SQL Server 2012. Many web applications use paging to show 10 or 50 rows per page and allow the user to scroll through each page of results rather than download the entire set. In SQL Server 2012 the T-SQL syntax has been updated introducing keywords that facilitate a simpler and more efficient paging, keywords such as OFFSET, FETCH, NEXT ROWS and ONLY.  While it doesn’t provide significant performance improvements over the tedious CTE solutions we use today, it certainly makes the code easier to write.

FORMAT() : As its name implies, the FORMAT() function used to make formatting easier, FORMAT() is clearly a much more scalable approach to formatting strings, and is one of the T-SQL enhancements in Denali.  Check out here for more detail with example.

New Logical Functions: There are the two new logical functions in SQL Server 2012: (IIF andCHOOSE)

Sequence: A sequence is a user-defined schema bound object that generates a sequence of numeric values according to the specification with which the sequence was created. Please explore more about Sequence.

File Table: Typically a CMS or some other type of website will allow users to upload pictures, documents etc. Common scenario to save as binary content in the database or other approach would be to store the files on the disk and store related data (filename, extension, length, path etc.), in DB.

SQL Server 2012 offers you the filetable feature. This is a solution built upon the FILESTREAM feature which means storing the binary data outside of the MDF (Main Data File) of the database in order to avoid degrading the performance of the typical structured data. The major benefit of FileTable is it has Windows API compatibility for file data stored within an SQL Server database. With FileTable feature now we can have non-transactional access to files stored in the DB as a windows share along with transactional access via T-SQL. I'll write more about this feature in separate post. You can also check here for more details. 

Happy Programming!!!

Popular posts from this blog

C#: Merging Excel cells with NPOI HSSFWorkbook

In this post we’ll see how to merge the two or more cell with each other while creating the excel sheet using NPOI.
Mentioned below is code to merge multiple cells, in this example we are merging first cell to fifth cell of first row (you can adjust row or cell range by passing particular parameters in CellRangeAddress).
//Created new Workbook var hwb = new NPOI.HSSF.UserModel.HSSFWorkbook(); //Create worksheet with name. var sheet = hwb.CreateSheet("new sheet"); //Create row and cell. var row = sheet.CreateRow(0); var cell = row.CreateCell(0); ; //Set text inside cell cell.SetCellValue("This is Merged cell"); cell.CellStyle.WrapText = true; //define cell range address // parameters: -> first row to last and first cell to last cell var cra = new NPOI.SS.Util.CellRangeAddress(0, 0, 0, 4); //Add merged region to sheet. sheet.AddMergedRegion(cra);
Hope this solution helps you J

Read and parse a CSV file into an array of rows and columns in C#

The following PopulateCsvIntoArraymethod used to read the CSV file into a two-dimensional array of strings.
I have included explanation of method lines, wherever needed. ///<summary> /// Populate the CSV file into an array, /// We assume that every line has the same number of fields and there may be blank lines. ///</summary> ///<returns></returns> privatestring[,] PopulateCsvIntoArray() { // Get path of CSV file. var path = Server.MapPath("~/Folder_Name/testfile.csv"); // Get the file's text using ReadAllText method. string fileData = System.IO.File.ReadAllText(path);
// Split CSV data into lines.     fileData = fileData.Replace('\n', '\r'); string[] lines = fileData.Split(newchar[] { '\r' }, StringSplitOptions.RemoveEmptyEntries);
// Get rows and columns counts. int totalRows = lines.Length;

Calculate Sum and average of two or more Textbox values using JQuery

We can calculate sum and average of values entered in textboxes with the help of small piece of jQuery code.
First of all let’s create a HTML form where we’ll ask user to enter marks in each subject, under body section add following HTML:
<tableclass="demo-table"> <trclass="label"> <tdcolspan="2">Please enter marks(0-99):</td> </tr> <tr> <td>English</td> <td> <inputtype="text"class="txtMarks"name="txtMarks"