Vikram Kamath

March 23, 2007

World cup cricket: India out of the world cup

Filed under: Cricket — Vikram @ 21:20

Good riddance to another rubbish from the Indian cricketers until the next world cup.

India are finally out of the world cup after loosing, again pathetically, against the mighty Lankans. Even though Indian bowlers tried to contain them by getting wickets constantly, the batting order were not that lucky. They were set a target of 255 by the Lankans.

Tendulkar, with all his experience, again out on a duck in possibly his last world world cup. Dhoni, what more can be said about him. He was out of the first ball he faced in the match. It was indeed a great ball from Muralitharan. Yuvraj Singh, run out. Sehwag tried his best, but not enough I reckon. Dravid, the captain, tried to glue himself at the crease, was unlucky. Wickets kept falling at the other end. I reckon he lost his calm at one point and started hitting some good strokes taking him to 60 before he was caught my Muralitharan off Jayasurya. After his dismissal, there was no going back. Our tail-enders cannot handle the Lankans by any means. I must commend Harbhajan for his unbeaten 17. Indians were finally bowled out for 185 and were sent packing back home by the mighty Lankans.

The Indians are now on their way back to India. Dravid, needs to answer many questions back home. His captaincy seems to have gone for a toss. He dosen’t have the wao factor that Ganguly had as a captain. Ganguly may not have scored heavily as a captain, but he had the capacity to turn the game around.

Anyways, good riddence to the rubbish cricket from the Indians, at least for this world cup. Who knows whats more to come. India can just hope a miracle to happen. I saw their faces after they lost the match. A sense of shock. They can now just hope against all odds that Bangladesh will loose to Bermuda.


March 21, 2007

Partitioned views: CHECK constraints with NOT FOR REPLICATION clause

Filed under: SQL Server — Vikram @ 17:08

I am posting this entry to remind myself about what happens when you have the NOT FOR REPLICATION clause with a check constraint on a column in a table.

I was going through how data partitioning can be achieved in SQL server 2000/2005. As mentioned in the one the various articles on the internet, the simple way is to create identical tables with the same primary key columns and have a view on top that includes each of the tables with a UNION clause. However that is not the scope of this post.

The scope of this post is the impact on queries on partitioned views by having a check constraint in the underlying partitioned tables and that the check constraints are created with a NOT FOR REPLICATION clause. I have a standalone database without any replication involved. I would do the following for example:

Create two identical tables:

create table [dbo].[Table_1]
                CHECK NOT FOR REPLICATION ([TableID] BETWEEN 1 AND 999),  
 [AnyOtherColumn] int  NOT NULL ,  
) ON [Primary]

create table [dbo].[Table_2]
                CHECK NOT FOR REPLICATION ([TableID] BETWEEN 1000 AND 1999),  
 [AnyOtherColumn] int  NOT NULL ,
) ON [Primary]

Note the NOT FOR REPLICATION clause in the check constraints on the TableID column.

Creating a view on top of that

create view TableView
 select * from Table_1
 union all
 select * from Table_2

Now use the following query to see the query execution plan:

select * from TableView where TableID = 10

In SQL server 2000 the query execution would look like this:

In SQL server 2005 the execution plan would look like this:

In both cases you would notice that there is an index scan on both the tables that are part of the view. What would happen if there was no primary key? It would have done a table scan on all the tables. In this example there are only two tables. What would be the performance hit if there are many more tables with huge amount of data in it? The last thing you would want is a table scan on all tables to retrieve just one row.

Now drop the tables and the view and create them again, now without the NOT FOR REPLICATION clause in the check constraint.

create table [dbo].[Table_1]
                CHECK ([TableID] BETWEEN 1 AND 999),  
 [AnyOtherColumn] int  NOT NULL ,  
) ON [Primary]

create table [dbo].[Table_2]
                CHECK ([TableID] BETWEEN 1000 AND 1999),  
 [AnyOtherColumn] int  NOT NULL ,
) ON [Primary]

create view TableView
 select * from Table_1
 union all
 select * from Table_2

Now see the execution plan for the same query

select * from TableView where TableID = 10

This is what you see in SQL server 2000:

This is the execution plan on SQL server 2005

The difference this time is that it has done an index seek only on the partition where the data would be present. Since the check constraint on Table_1 allows values for TableID column only in the range of 1 and 999, it picks up data only from that partition table and does not bother looking for it in the other tables in the view.

So, why does the NOT FOR REPLICATION clause on the check constraint reduce the performance of the query so drastically?

Do not use the NOT FOR REPLICATION clause unless you need it.

Now, to add to the fun create the tables again, now with the primary key as clustered and without NOT FOR REPLICATION clause. Run the query execution plan for the same query again.

On SQL server 2000

On SQL server 2005

On both SQL server versions there is a clustered index scan just on the partition that is in the scope of the query.

If any one of you figures out why the NOT FOR REPLICATION on the check constraint makes such a huge query degradation, I would like to know why.

I have opened a thread on the MSDN forum for the same problem. You can find it here.

March 19, 2007

World cup cricket: Comfortable win for India

Filed under: Cricket — Vikram @ 21:31

Virender SehwagIndia played against Bermuda today. The Indian batting line up, after closing a lost chapter against Bangladesh, scored a record breaking total of 413 for the loss of 5 wickets in 50 overs. Sehwag scored the much awaited century. Ganguly added 89, Yuvraj 83 and Tendulkar, an unbeaten 57. Dhoni added a smashing 29 of 25 balls with Dravid finishing the innings with a six. In all a comfortable and a well earned world cup record total. Even if it is against a weaker and inexperienced Bermuda, it is in the history books.

Next was Bermuda with the bat. India had to contain runs and bowl them out for a very low score in order to have a better chance of getting into the super-eights on run rate. Although Bermuda kept loosing wickets constantly, I still felt that the Indians could not contain the runs. They did bowl well, but it did not impress me for their class. Again, a very mediocre performance with the ball. They could not get Hemp out who stuck impressively on the crease scoring an unbeaten 76 runs. He was the only batsman who scored for Bermuda. Bermuda managed to score 156 and dragged until the 44th over.

The Indians did manage a comfortable victory but I feel they could have bowled Bermuda out at a much lower total. India stands second on run rate in its group with three teams (Sri Lanka, Inda and Bangladesh) tied at 2 points each.

March 17, 2007

World cup cricket: Another best of the worst from Indians

Filed under: Cricket — Vikram @ 23:34

Today’s world cup battle against the Bangladeshis turned out to be one of the best of the worst for Indians. They have had a humiliating defeat against the so called “relatively inexperienced” Bangladesh team. I must say, I am not a hardcore cricket enthusiast, but I try and keep myself updated with the latest. I happened to see the match today. I started watching when Indians were playing at 90 for the loss of 4 wickets and Saurav Ganguly and Yuvraj Singh were at the crease. Looking at the Indian scorecard, they seemed to be on the loosing front right from the beginning. Sehwag, Tendulakar, Dravid, all back in the pavilion.

Although, Ganguly and Yuvraj, seemed to stabilize the situation for India at one point of time, all that was washed away when Yuvraj got out at 47, followed by Ganguly, Dhoni, Harbhajan and Agarkar in a span of just 2 runs. Ultimately, the Indians were bowled out at a total of 191 runs, thanks to some good and some lucky strokes by Zahir Khan and Munaf Patel at the end with both adding 15 runs each.

Then came the so called “relatively inexperienced” Bangladeshis with the bats. They, had nothing much to do I reckon, except for playing calmly and not loosing early wickets. The Indian bowling attack was not that great. Very mediocre for their experience in the game. Even, Bhajji didn’t seem do any magic with the “doosra” nor did Tendulkar, compared to the spinning attack by the Bangladeshis. This allowed the Bangladeshis to reach their target calmly with the loss of 5 wickets in the 49th over.

In all the Bangladeshis had a historic win against the Indians today. What happened to the Indians in the field today? They seemed to be showing no contention even whilst fielding. The Indians have been totally outplayed by the Bangladeshis in all respect in the field today.

India still has hopes of making up to this loss.

But the first major upset in this tournment is that Pakistan is out of contention for the world cup 2007. They lost against Ireland today. It was another major upset, worse than India’s loss against Bangladesh. The Pakistanis were surprisingly bowled out for just 132 on board. Ireland, being supposedly made up of amateur cricketers, crawled to victory to reach a revised target of 128 in 47 overs. This match ended with a six by Trent Johnston of Azhar Mahmood. Again, a historic win for the Irish in world cup cricket. They are probably through to the Super-Eights, while the Pakistanis are on their way home.

Sadly, there won’t be the India -Pakistan clash in this world cup. Hope India fairs well. Come on India!!!!!!

March 8, 2007

Cumulative hotfix for SQL Server 2005 SP2 is now available

Filed under: SQL Server — Vikram @ 23:15

Cumulative hotfix package (build 3152) for SQL Server 2005 Service Pack 2 is available.

 For more information about the bug fix list, follow the link.

Not long since SP2 was released.

February 23, 2007

Nostalgic memories of MIT Manipal

Filed under: General — Vikram @ 19:39

I just happened to think about the back old days when I was in college in MIT Manipal. I happen to find a few videos on YouTube of the college where I used to study back in those days. I saw the videos and realized so many things have changed in and around the campus in these years. The main block, and the other block which we used to call the new block (its not new anymore), the library block, the workshop blocks where we used to learn carpentry and metal fitting in our first year of university and last but not the least the off college hang outs, all these have changed considerably. All this creates and feeling of nostalgia within me. This also sometimes makes me feel sad about the fact that I did not have easy access to Internet technology then, to put up my memories on the Internet forever. Actually, Internet and having a computer at home were a very big and an immensly expensive affair in those times which actually are not long gone.

I had to put some of these up here so that I can get back to them when I need to.

This is another good video about life in Manipal:

It is a real challenge to keep in touch with all my mates from college. All have spread far across the globe. Even in this Internet age, I find it hard to keep in touch. But, I do try hard to keep in touch with as many people as I possibly can.

I don’t know how many of you are in touch will your mates from college?

February 19, 2007

Microsoft releases SQL Server 2005 Service Pack 2

Filed under: SQL Server — Vikram @ 17:16

It is here and ready for download. Microsoft has officially released SQL Server™ 2005 Service Pack 2. It can be downloaded from here.

Books Online available here


SQL Server 2005 SP2 will be available soon

Filed under: SQL Server — Vikram @ 14:35

Microsoft seems to be almost there with SQL Server™ 2005 Service Pack 2. The RTM should be available soon, real soon. Although they have not set a date yet, it should be released very soon.

For more information visit the following links:

To know what is new in the Service Pack 2, click here.


I came accross this link that claims its going to be released today (19th February 2007). So, I believe it should be out anytime now.

February 10, 2007

SQL Server 2005 SP2…… When???

Filed under: SQL Server — Vikram @ 20:45

It has been almost a year since SQL Server 2005 Service Pack 1 (SP1) was released. And now many of us are waiting for the release of Service Pack 2 (SP2).

We found an issue with SQL Server 2005 SP1 last week. It started with the following error in the application which was running seamlessly for every other operation except for one operation, when it was running on SQL server 2005 SP1.

Fatal error 3624 occurred at Feb 5 2007  2:34PM. Note the error and time, and contact your system administrator.

A severe error occurred on the current command.  The results, if any, should be discarded.

Location:  IndexRowScanner.cpp:370
Expression:  m_sizeOfBuffer > currentOffset + colLen
SPID:   54
Process ID:  2712

In the beginning we thought it may be something in our application. But when I checked the process ID in the task manager it turned out to be SQL server 2005 process. The SPID was the application server’s connection to the database.

Immediately we turned to the wonderful SQL Profiler, and this is what we saw:

SQL Server Assertion: File: <IndexRowScanner.cpp>, line=370 Failed Assertion = ‘m_sizeOfBuffer > currentOffset + colLen’. This error may be timing-related. If the error persists after rerunning the statement, use DBCC CHECKDB to check
the database for structural integrity, or restart the server to ensure in-memory data structures are not corrupted.

Warning: Fatal error 3624 occurred at Feb 5 2007  3:00PM. Note the error and time, and contact your system administrator.

2007-02-05 15:00:23.04 spid54      Error: 3624, Severity: 20, State: 1.
2007-02-05 15:00:23.04 spid54      A system assertion check has failed. Check the SQL Server error log for details

We investigated further to find out the point of failure. We found that there were certain SQL statements that were being executed against the database because of which SQL server was throwing the assertion error. The common things between these statements were the table being used in the statements and the fields. To be more specific it was to do with all the bit fields in the table. Some of the statements were updating the bit fields, and in some statements the bit fields were part of the where clause. Even a simple statement like SELECT MY_BIT_FIELD FROM MY_TABLE was failing with the same assertion error.

We then went into the MSDN forums and learnt that there were issues with bit fields that have been fixed as part of the SP2. So, I installed the SQL server 2005 SP2 Community Technology Preview (CTP). And to our luck our problem was resolved.

Now the question was, when will SQL server 2005 SP2 RTM be available? I learnt from Jim that it is expected in the first quarter of this year. This means it should be available anytime in the next three months. I hope Microsoft will release it as scheduled. For more information about the same Jim pointed me to SQL Server Manageability Team Blog.

Hope this helps you.

February 6, 2007

Hurray! All blogger posts imported

Filed under: General — Vikram @ 18:19

Hurray!! Finally, wordpress has given me what I wanted before I moved completely to wordpress and that is importing all my posts (not a huge number though) from my blogger blog into here. This is really great. Now I hope to bid good bye to blogger and continue blogging here. Thanks very much guys.

I had a few javascript problems during imports on Internet Explorer 7 (IE7). But I managed it alright with FireFox.

I did have to edit a couple of posts as wordpress says a big NO to javascripts in posts. I had a few flickr badges that use javascripts and they were not showing up. So I had to remove them and set them as links to the albums on my flickr.

End result is that I am quite happy with the results and I would continue on this amazing arena.

February 2, 2007


Filed under: General — Vikram @ 19:24

Welcome to my new blog on wordpress. I have been blogging on blogger till now until Tom told me about wordpress. This is really cool and I like the settings and ease of publishing posts on wordpress.

I started this blog with an intention of moving all my blog posts from blogger to here. This was not possible as I upgraded my old blogger login to my google email account. Later I learnt that wordpress could not import blog posts from the new blogger that uses the google email logins. This put me off a bit.

The one new thing I learnt today is that we could publish blog posts on blogger as well as wordpress from Microsoft Word 2007. This is a real cool feature of Word 2007. The only problem with posting on blogger is that it (blogger) does not accept images from Word 2007 or for the matter of fact, from any other publishing tool I reckon.

So this is my first post on my new blog directly from Microsoft Word 2007. I hope to get all my posts migrated from blogger some day. I hope to blog regularly here. I am still in two minds, whether to discontinue blogger and make this my primary blog. And until I make up my mind, I would still keep my blogger account active.

Here is the snapshot of Word 2007 blog publishing tool.

October 22, 2006

Diwali 2006

Filed under: Fun — Vikram @ 15:26

Its been ages since i blogged about anything. I say the same thing whenever I am away from blogspot for a long time. Anyway, I am back again.

We celebrated diwali, the festival of lights with a few friends in Basingstoke yesterday (21st October 2006). We celebrated the festival at my friend Neeraj’s place starting with a small “pooja” and then bursting some good fireworks. There were rockets, sparklers and more. Here are some pictures of the small event. Enjoy!

April 16, 2006

Please leave a message

Filed under: General — Vikram @ 21:14

I just happened to check the hit list on this blog. There are many people all over the world who are searching for “vikram kamath” and ending up on this blog. Its a good thing. But I would like to know who you are, just in case i know you. So, I request you to leave a message or a comment on the blog so that possible old friends can get back in touch again.

Cheers and thanks.

April 12, 2006

Regular Expression for folder paths

Filed under: Programming — Vikram @ 13:15

I have been looking for a regular expression that allowed me to validate a folder path on a local machine or a shared directory path using UNC with server name or UNC with IP Address. I did find a regular expression on But it didn’t seem to be solving my purpose. So I went about modifying it. I ended up creating different one. Many of you may have done this already. But this was a small exercise on my part to get to build a regular expression. So here it is.

Regular Expression: ^((([a-zA-Z]:)(\\{2}[a-zA-Z]+)(\\{2}\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))(?=(\\(\w[\w ]*)))(\\\w[\w ]*)*)$

Matches: c:\folder one\folder2\folder 3 , \\remoteMachine\folder1, \\\folder 1\folder2Non Matches: c:\\folder one c:folder 1, c:\folder 1\\folder 2, \remoteMachine\folder 1, \\remoteMachine\\folder 1, \\remoteMachine\folder 1\\folder2, \\\\folder 1, \\\folder 1\\folder2

Hope this helps anyone who needs to use it.

April 2, 2006

Fiat gone, Nissan in!!

Filed under: General — Vikram @ 14:54

Got rid of the Fiat Brava last tuesday and bought this Nissan Primera Precision.

« Newer PostsOlder Posts »

Blog at