Thursday, May 31, 2007

Passing a table to a stored procedure

This week, my column at sqlservercentral discussed about passing a table to a stored procedure. This is something that we need, to make reusable stored procedures. However, SQL Server does not still support passing a table variable to a stored procedure. So my column this week, demostrated a workaround to get this done.

If you happen to read my articles, I would suggest you go through the discussion forum too. The discussion forum is the place where people can discuss about the article and share their ideas. Many of the times the articles generate a spark and you will find great ideas from many SQL Experts.

So I would suggest that you click on the link Join the discussion. When you are in the discussion forum, click on the link Watch This Topic. This will make sure that you will get a notification email when a new comment is posted in the forum.

There may be comments that encourages, some of them may be criticizing, and many of them will be sharing new ideas. SQL Server Central is a place where you can find many SQL Server Experts and hence, most of the times, you can see them sharing their ideas and approaches in the forums.

Most of the times, I see that, when I present an approach to do a certain task, many people respond with alternate approaches which explains how they used to handle the situation/task. Some times, those approaches will be better than what I present in the article. So make sure that you read the comments and spend time to understand the great ideas shared by large numbr of SQL Experts at the forum.

You can find this week's article here and the discussion forum here.

Tuesday, May 22, 2007

Writing faster TSQL

One of the programming tasks that interests me most is the optimization part. It is a pain and joy to have a piece of code running faster than it was. It is a pain because the efforts needed to get the task done are much more than one would expect. I have seen people asking: "Hey, this query takes 20 seconds. Please make sure that it runs in 2 seconds. I need it by the evening, please". It is a joy, because, most people would love to see things working exactly as we expect and wanted.

Optimizing a piece of code for performance includes walking through each line and compare the performance factors of each line of code. These performance factors needs to be compared with alternate syntaxes which provides the same result. However, what is most important is the understanding of the engine which executes your code. If you understand how the engine does the work, then you can write instructions in a way that the engine would be able to perform better.

I have started writing a new series of articles at SQL Server Central which would concentrate on providing various hints to write faster TSQL code. The first article in this series is available here

Wednesday, May 09, 2007

SQL Server 2005 and XML Processing

I am very much excited to see a lot of positive feedback on the discussion forum on the last article. This encourages me to come up with a few more articles to cover the rest of the XML processing topic.

Thankx to everyone for your feedback and comments.

Advanced XML Processing with SQL Server

You could format the results of a query into XML format by using the FOR XML keyword. However, most of the times the default formatting or structure may not be helpful for the specific purpose we are looking for.

Many times we would need more control over the way the XML is formatted or structured. I have a new article at SQLServerCentral, which explains how control the structure of the XML result and format it the way we wish.

Tuesday, May 01, 2007

Configuring Analysis Server 2005 for HTTP Access

A few months back we had been trying to upgrade from Analysis Server 2000 to 2005 and had quite a few issues while configuring the server. I have put up an walk-through at SQLServerCentral which explains the basic configuration details.