Wednesday, May 26, 2010


ELMAH - Error Logging Modules and Handlers can be plugged into any Web based ASP.NET application for application wide logging. It's an awesome open source project. To read more about how to configure ELMAH -

How to configure ELMAH on IIS6 for SQL SERVER

  1. Download the ELMAH binaries from

  2. Copy the ELMAH.dll to your application's bin folder.

  3. Add the following to the web.config file

  4. Run the DDL script from this URL on your database to create the necessary table and stored procedures.
  5. Now navigate to http://yourwebsiteurl/elmah.axd

Monday, May 24, 2010

Concatenate multiple rows into one string using SQL

I needed to concatenate the multiple rows of a query into a string. I could have used a function to do the same but I need to do that via SQL on a ORACLE database.


Note: This has got a limit of 4000 characters. Good to use in subqueries where you are trying to concatenate less no. of rows. SYS_CONNECT_BY_PATH is only available in Oracle 9i version or later. For earlier versions you need to write a function to do the same.

Thursday, May 20, 2010

SQL SERVER 2008 R2 Express upgrade failing

I was trying to upgrade my SQL SERVER 2008 Express with Advanced Series instance to SQL SERVER 2008 R2 Express with Advanced Series.

The upgrade was failing with the upgrade rules especially with SQL SERVER 2005 tools. Note: I had SQL SERVER 2005 installed in the same Virtual PC

To upgrade to SQL SERVER 2008 R2 Express make sure to remove the SQL SERVER 2005 tools via Add/Remove programs. Probably it won't appear in the same name instead you need to remove SQL SERVER 2005 but chose the Workstation components to uninstall and not the Database engine.

Once removing it try the upgrade and it will work successfully.

SSIS Terminologies

SSIS - SQL SERVER Integration Services (since SQL SERVER 2005) previously named as DTS - Data Transformation Services

SSIS is an ETL application - Extraction Transformation Load
BIDS is the Development tool - Business Intelligence Development Studio
Package - Product that SSIS produces
Control flow - Workflow of a package
Data flow - Movement of data in a package
Task - Individual Unit of Work
Transform - Individual Unit of Work in a data flow
Event Handler - Handle errors, warnings or events.

Run Exe's in Windows 2008 Task Scheduler

I had a requirement where I needed to run a program as a scheduled task. I configured the program but it wasn't firing the exe at all. At last I figured out that I cannot execute an EXE via Task Scheduler and used a batch script to wrap the EXE call and scheduled it in Task Scheduler.

@echo off
echo %date% %time% Start of task > c:\temp\test.log
echo User=%UserName%, Path=%path% >> c:\temp\test.log
c:\Tools\Task.exe 1>>c:\temp\test.log 2> c:\temp\test.err
echo ErrorLevel of c:\Tools\YourTask.exe=%ErrorLevel% >> c:\temp\test.log
echo %date% %time% End of task >> c:\temp\test.log

How to get a range of rows in SQL SERVER and Oracle?

I had a request where I need to get a specific set of rows with a start row number and end row number and I needed to have the Query for both SQL Server and ORACLE.




AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts

If you are using Dynamic data controls and if you get the following error?

Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the AjaxScriptManager in System.Web.Ajax.dll, or use the ToolkitScriptManager in AjaxControlToolkit.dll.


Are you using ScriptManager or ToolkitScript manager? You need to use the ToolkitScriptManager in order for the new AJAX Toolkit to work.

<asp:ScriptManager ID="ScriptManager1" runat="server" />


<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>

SSIS: Connect to Oracle database

I've been trying to access data in Oracle from SSIS via OLE DB and was getting the following warning:

"Cannot retrieve the column code page info from the OLE DB Provider. If the component supports the "DefaultCodePage" property, the code page from that property will be used. Change the value of the property if the current string code page values are incorrect. If the component does not support the property, the code page from the component's locale ID will be used."

Set AlwaysUseDefaultCodePage=TRUE on the OLE DB Source component that shows the warning and it will work fine