Archives: July 2011
T-SQL cursors are generally bad approach and are often misused. In today’s world of correlated subqueries, CTE’s, recursive CTE’s, ranking and windowing functions (ROW_NUMBER, RANK, DENSE_RANK, NTILE) and other tools, you have really few moments where cursor is better solution. On the other hand, there are still scenarios where cursor… Read more
I was studying SQL Azure parameters some time ago and found out that there are no materials which tell you clearly what it is, what it costs, what are limitations, what developers can and can’t do etc. There are so many marketing materials, business materials and even very technical materials… Read more
Keeping your SQL objects’ naming rules during furious development is hard. New levels of information are added continuously, entities are being splitted, then joined together again, entities are often renamed several times just because you have better name for them etc. For me, renaming is heart of T-SQL refactoring. But… Read more
SELECT COUNT(*) is most common method (and exact) how to find out how many records is in table. There is also another method which is not exact but is way faster especially when you are expecting zillion of rows to be counted. This method is based on fact that SQL… Read more
While playing with SQL Server 2011 “Denali”, I’ve accidentally found out that it has slightly enhanced intellisense in SSMS. There is one thing which I really like much – partial name matching. Prior to SSMS 2011 you had to enter object’s first letters in order to be completed by intellisense.… Read more
Steve Jones from voiceofthedba.com, editor on SQLServerCentral.com gave me an opportunity to publish humble article about workaround solution for using temp table in user-defined function. I was very pleased and I am now proud that my article is on SQLServerCentral homepage (at least for today).
After reading discussion under article… Read more
I am desperately trying to finalize this add-in and it is very very close. I was performing another testing on few thousands of objects and found out that add-in is causing instability to Management Studio from time to time while handlilng this high numbers of objects. It is very hard… Read more
I am going to describe quite forgotten feature in SQL Server 2008. It is Change Data Capture (CDC) – powerful feature to track changes in database (tables) without touching table’s schema. There are two features in SQL Server 2008 which support similar thing and look same but they are not… Read more
T-SQL debugging is not 100% in SQL Server. It has few bad drawbacks starting from difficulties when setting it up and ending with inability to view any data table during debug.
I have an idea for post for DBAs who use T-SQL debugging and are interested in improving debugging experience.… Read more
I was facing quite well-known issue today – I had to develop logic of duplicating (versioning) parent-child records. Because I was not fully familiar with database schema I simply didn’t know which entities I should involve. I am very visual person and that’s why I employed Red Gate’s tool called… Read more
While I was reading Martin Catherall’s post about Selecting from a table with no rows returned I remembered TABLESAMPLE function which does similar thing.
I continued to check SQL Server 2011 “Denali” for few things I dislike on 2008 R2 and tried to find out whether they were improved (first part is here).
On my current project, I am dealing with date intervals in T-SQL very heavily. I’ve hit interesting issue recently – how to combine/merge date intervals into more intervals.
I am talking about this:
I was googling and googling but found only not suitable solutions or solutions which I don’t like.… Read more
I’ve received interesting question/requirement few days ago:
“… When viewing a query plan graphically, we usually have to hunt for the most expensive operator. In some queries, it’s hard to spot ‘em due to the high number of operators. It would be cool to have a keyboard command that would… Read more
My wife and kids are leaving for holiday (without me). Bad thing is that I will miss them, good thing is that I will finally finish my SSMS add-in I promised. If you are not aware about it, read here why I am developing it.
After this SSMS add-in development… Read more
I wrote about some skeletons in the Denali’s closet here. Let’s also put some good on the table. Very handy new thing in Denali is the way how you can rethrow error in catch block.
In SQL Server 2008 you must do this to rethrow error:
BEGIN TRY --…
I’ve started to play little bit with SQL Server 2011 CTP Denali to find out whether some open wounds were healed yet. I like new things in Denali but I’ve hit one thing I am still terribly missing. This is RAISERROR in function.
Today is black day for me because… Read more
I’ve faced pretty common situation recently – you need to work with huge data during development/testing. It’s good if you have option how to access large data volumes XXX% faster on your laptop. I can imagine many other scenarios when you need to work with hundreds thousands of records on… Read more
I was running some database unit tests and needed to drop completely everyhing in my database. There are really many ways how to do that but I like following way because it kills all existing connections automatically and can be executed with one keystroke. It is not any rocket science… Read more