Translate

Sunday, August 7, 2011

@Refresh Colombo

This was my first presentation in public outside Microsoft technologies. Presentation was on MongoDB which Susantha and myslef are doing quite a bit of R&D lately.

Our presentation went well and had few questions from the audience which was just over 1000.

Entire event was covered by adaderana

You can view all the pictures at facebook and samples are available in my skydrive.

Saturday, July 30, 2011

Function for End of Month

Did you have a requirement  of getting last date of the month by passing any date. I can remember I had this requirement during SQL Server 2000 days, in a HR system.

If you search for this in Google followings are the results.

image

There are around 2,350,000 results!. In these results, there you might they have used DATEDIFF and DATEADD functions.

With Denali CTP3 (not sure whether this was there in CTP1) new function called EOMonth is included. Now it is simply matter of passing date.

You can see the a syntax in the following image. Point to note here is there is no execution plan differences between this version and the previous. So only difference will be the usability,

image

Wednesday, July 20, 2011

MongoDB @Refresh Colombo

This is my first presetion on MongoDB in public. I did few presentation in office before this on same subject and written two articles to office Magazine. One of those articles won the best article award. So let's see how this will go @RefreshColombo

Friday, July 15, 2011

Are You Using SSMS effectively ?

SQL Server Management Studio is an essential tool for DBAs and developers. But are you using it effectively? In this article, I will try examine a few tips and techniques which could well boost your efficiency using SSMS.

Read the entire article here

SQL Server 2008 R2 SP1 Released

SQL Server 2008 R2 SP1 release was not much highlighted since Denali CTP3 is making all the headlines.

untitled

Microsoft SQL Server 2008 R2 Service Pack 1 delivers hotfix solutions from SQL Server 2008 CU 1 to CU 6 in addition to resolving to customer requests with key security and supportability issues. SQL Server 2008 R2 SP1 has also seen 8% less bugs requiring resolution within the Service Pack scope when compared with SQL Server 2008 SP1.

Related Links:

·        Download SQL Server 2008 R2 SP1

·        Download SQL Server 2008 R2 SP1 Express

·        Download SQL Server 2008 R2 SP1 Feature Packs

·        Knowledge Base Article for Microsoft SQL Server 2008 R2 SP1


Thursday, July 14, 2011

Denali CTP3 Now Available

Much anticipated Denali CTP3 is now available for download from Microsoft. This is the third Community Technology Preview of codenamed Denali.

According to Microsoft, SQL Server 2012 codenamed Denali will enable customers to:
“•Deliver required uptime and data protection with AlwaysOn
•Gain breakthrough & predictable performance with Project Apollo
•Help enable security and compliance with new User-defined Roles and Default Schema for Groups
•Enable rapid data discovery for deeper insights across the organization with Project Crescent
•Ensure more credible, consistent data with SSIS improvements, a Master Data Services add-in for Excel, and new Data Quality Services
•Optimize IT and developer productivity across server and cloud with Data-tier Application Component (DAC) parity with SQL Azure and SQL Server Developer Tools code name “Juneau” for a unified dev experience across database, BI, and cloud functions.”

Though there is no official yet, it is believe that this version of SQL Server will be named as 2012 not as 2011 as said some time back. Nice way of postponing the release!

SQL Server 2012 Codenamed Denali CTP3 is available for download here.

Friday, June 24, 2011

How long does it take to fix a bug

In the development cycle, it is needless to less we all in some part of our carrier, have injected  bugs in different scale. However, when we were told it is a bug, I am sure most of you try to fix it or prioritize it to fix it.

But can you imagine, if there is a bug in SQL Server for more than 5 years, ranging three SQL Server Products (SQL Server 2005, SQL Server 2008 and R2).

This bug is in CTE.

Now CTE was introduced primarily to support recursive queries.

Let’s say I have a table and data like this.

image

So I have a hierarchy as following.

image

Let’s assume that, you need to retrieve, only two levels starting from Richard, here is the query you should use.

image

so number of levels are handled by , MAXRECURSION = 2 option. In this of course, you will get the result but also and ERROR!!!,

yes, error says,

Msg 530, Level 16, State 1, Line 1
The statement terminated. The maximum recursion 2 has been exhausted before statement completion.

You can say that since it giving the correct result, what is the big deal about this. But the problem here is, since it is a Level 16 error, if you are using this inside of your code, your code will throw an exception.

You have a workaround which I have given in my sample code at the end of this post.

Now this error first appeared in SQL Server 2005 and Microsoft has make sure that they don’t fix this so you can see the same bug in SQL Server 2008 and in R2. I got to know that this was initially reported in 2002 when SQL Server 2005 CTP was released. So it is nine years now.

To confirm the stuff, I checked this in Denali CTP1. Guess what, still this issue in the backlog.

error.cg

Download sample code from here

Monday, June 13, 2011

Altering a Column Which has a Default Constraint

If you are altering a column with default column, you need to drop it. but the problem will be if you created a default constraint without explicitly specifying  constraint name. Here is a faq from me.

Thursday, June 2, 2011

xp_msver

xp_msver is a extended stored procedure, to get some valuable information in SQL Server.

EXEC master.dbo.xp_msver

Will return,

clip_image002

Most important parameters that I can think of is, ProductVersion (not a big deal since you can get this from ServerProperty function), ProcessorCount, Physical Memory.

Next question is, why you would need this?

Let’s say, you need to set the Maximum Degree of the Parallelism (MAXDOP) as a function of number of Processor count. For example, some DBAs want to have MAXDOP to, ProcessorCount – 2.

 

image-

Similarly you can set the memory allocation as well.

Download relevant script from here