Rich Blumer

professional software developer

Archive for the ‘SQL Server’ Category

Installing SQL Server Express 2008

Posted by rblumer on Jul-24-2008 under SQL Server

Last night I downloaded SQL Server Express 2008 (CTP version). Everything went well until I tried to find the Management Studio IDE. It was nowhere to be found. So I tried to connect via the Management Studio 2005. Unfortunately, I received a message stating this version of Management Studio could only be used with SQL Server 2000 or 2005. By now, I am a little frustrated so I googled why Management Studio 2008 was not installed. I found out that Management Studio 2008 is not included with SQL Server Express 2008 (CTP version) setup. Why? I have no idea. It seems this would be a must-have for this installation.

After I uninstalled SQL Server Express 2008 (CTP version), I installed SQL Server Express Advanced, which includes the Management Studio 2008. I will share with you on how to successfully install SQL Server Express 2008 with Management Studio 2008.

My only issue during the installation was Windows PowerShell was not installed on my system. The picture below displays the Failed status next to Windows PowerShell.

If you click on the Failed link, the screen below will appear. You will need to download and install Windows PowerShell.

When the Windows PowerShell installation has finished, you can click the Re-run button to complete the Setup Support Rules. The status for Windows PowerShell should be Passed and the Next button should be enabled.

You can now choose the Features you would like to install for SQL Server Express 2008. You need to select Management Tools - Basic under Shared Features to have Management Studio 2008 installed.

I will not walk you through the rest of this installation since you can visit Microsoft’s site for those instructions. I hope this helps with your installation of SQL Server Express 2008.

SQL Reverse Function

Posted by rblumer on Nov-18-2007 under SQL Server

SQL Server has a Reverse function that I have found to be very useful. This function simply returns your expression in a reverse order. It is nice to use if you would like to start your string search from the right. Let’s use the following number as an example: 676777-9099999-86666 .

Now suppose I need to return the last part of the number, 86666.

I can get this result with the following code:

SELECT RIGHT(c.OrderNumber, (CHARINDEX('-', REVERSE(c.OrderNumber)) - 1))
FROM Customers c

The Reverse function would simply return 66668-9999909-777676, which probably is not very useful. However, I can use the CHARINDEX function to obtain the starting position for the first hyphen (’-') . Then I can use the Right function to retrieve the string, which turns out to be 86666.