Wednesday, April 30, 2008

A Function Gotcha with the Use of an Asterisk - SQL Server Central

Excel is my favourite tool for LD (Lazy Development).

Here's an interesting quirk that functions in SQL have when using Select *, and a workaround using Excel as a performance accelerator for development.

During a recent upgrade of our software, I discovered what I assume is a little-known gotcha that I feel appropriate to document and pass on. The gotcha occurs with user-defined table functions (UDFs), when selecting columns from a table using the asterisk (select all) method. The problem then occurs only when columns are subsequently added or removed from the based over table without recreating the function. When these conditions occur, it results in interesting and undesirable output. The SQL below illustrates this problem using SQL 2000.

A Function Gotcha with the Use of an Asterisk - SQL Server Central

One of the best features in Excel 2007 for SQL DBAs is the Conditional Format - Highlight Duplicates.  By using this, the tedious task of writing duplicate-finding sprocs is replaced with cut-paste-Conditional Format.

Now if only there was a data entry tool directly into SQL for Excel besides PerformancePoint.

No comments: