Translate

Sunday, December 25, 2011

New T-SQL Features in SQL Server 2012

 

In every version of SQL Server new T-SQL features are introduced. These are new T-SQL features of SQL Server 2012.

  • Sequences
  • Function
    • String function CONCAT,FORMAT
    • Logical function CHOOSE,IIF
    • Date & time function
      • DATEFROMPARTS
      • DATETIMEFROMPARTS
      • DATETIME2FROMPARTS
      • DATETIMEOFFSETFROMPARTS
      • SMALLDATETIMEFROMPARTS
      • TIMEFROMPARTS
      • EOMONTH
    • Conversion function
      • PARSE
      • TRY_CONVERT
      • TRY_PARSE
  • Paging Data
  • Lag & Lead
  • Exception handling
  • WithResultSets

Friday, December 23, 2011

Sample Databases for SQL Server 2012 RC0

 

Sample databases dedicated to SQL Server 2012 RC0 are released. AdventureWorks2008R2_Data.mdf and AdventureWorksDWDenali_Data.mdf are those files. You need to attach these mdf files to your SQL Server instance.

Download these sample data files from here.

Tuesday, December 20, 2011

New Express Edition : LocalDB

New to the Express family, LocalDB is a lightweight version of Express that has all its programmability features, yet runs in user mode and has a fast, zero-configuration installation and short list of pre-requisites. Use this if you need a simple way to create and work with databases from code. It can be bundled with Visual Studio, other Database Development tools, or embedded with an application that needs local databases.

Try it here today!

Monday, December 19, 2011

Drop a Database by Closing Existing Connections using SSMS or T-SQL

 

Dropping database from SQL Server is not a major task. However, it can be painful if that database is being used at time of dropping it. Read this FAQ from www.sql-server-performance.com

Wednesday, December 14, 2011

Two SPIDs in sp_who2

 

sp_who2 is function you can use to identify who (Login) is running at what (DBName, command) from where (SPID & Host) as you can see in the following image.

image

If you look closely, you will see that there are two SPID columns with same values. By looking at them, they are same So let us see the coding of this.

image

So you would see that SPID column is convert(char(5),spid) so why on earth same column twice.

Just see the comment after second SPID.

Handy extra for right-scrolling users.

Do you agree. I am not Smile .

Wednesday, November 30, 2011

TechInsights 2011

I was a speaker at TechInsights 2011 which was held in Malaysia at Monash University Kuala Lampur.

Well, this is my first appearance out side Sri Lanka and was a great experience.

I did two sessions 1. CDC for SCD and 2. Resource Governor. To be honest, first session was not much participated second one was far better.

Here are few photos of the sessions.

TI2TI3

TI1TI4

Here are Presentations and Samples

Saturday, November 19, 2011

SQL Server 2012 RC0

SQL Server 2012 Release Candidate 0 is now available for download. SQL Server 2012 RC0 (previously code-named Denali) includes several new capabilities (most of which are related to the release’s new features) that weren’t available in SQL Server Denali CTP3, including the following:

  • AlwaysOn—SQL Server 2012 RC0 offers multiple readable secondaries in AlwaysOn, which lets you better distribute backup and reporting workloads, and it now supports the FileTable and FILESTREAM data types.
  • Resource Governor—According the SQL Server Team Blog, SQL Server 2012’s Resource Governor includes several new capabilities, including support for 64 resource pools, enhanced CPU usage controls, and enhanced resource allocation.
  • Cloud Computing—SQL Server Management Studio (SSMS) now supports snapshot backups to Windows Azure.
  • Data Quality Services and Master Data Services—This release provides Change Data Capture (CDC) support for Oracle.
  • Power View—The data visualization tool includes new features with SQL Server 2012 RC0.

For more information about the upcoming release of SQL Server, see Microsoft’s SQL Server 2012 page. You can download SQL Server 2012 RC0 here.

Sunday, November 13, 2011

Combining Columns Ignoring Null Columns

Let’s start with an example.

image

You will see that MiddleName column has NULL values. If you want to combine all four columns and display them in one column you will write following query.

image

Result is,

image

You will realize the obvious problems from the above result set. To avoid this what you should is, use the ISNULL function.

image

Though the above will solve your problem, as a developer you need to keep an eye on nullability of the column.

With Denali, you have a new function called CONCAT.

image

And the result is,

image

which is what we were looking for.

Next question is, how about the performance.

To answer that I will display query execution plans for two queries, one with CONCAT and the other with ISNULL function.

image

So there is no additional cost with the new function.

Saturday, November 5, 2011

SQL Server 2012 Editions

SQL Server 2012 users will experience new SQL Server editions called Business Intelligence  to the addition of existing editions, Enterprise, Standard, Web , Developer, Express and Evolution.

image

image

image

If you wish for more news about editions and licensing click it here.