Author Archives: ben

SQL For Fun: Parsing the iTunes XML

What happens if one part of your personality is data-parsing nerd and another part is music lover nerd? You end up trying to answer questions like, “Which songs did I have rated with 4 stars last year that are lower … Continue reading

Posted in Apple, iTunes, MS SQL, Transact SQL | Leave a comment

Using Tally Table to Remove Invalid XML Characters

A couple of weeks ago, I was called in to troubleshoot an error occurring in a SQL stored procedure. The procedure was selecting a variety of information out as XML data. The error occurred because on of the columns being … Continue reading

Posted in MS SQL, REGEX, Transact SQL | Tagged , , , , | Leave a comment

Using SQL to Mege Three Incomplete Data Sets

You can join data sets. LEFT JOIN, RIGHT JOIN, even OUTER APPLY. There’s nothing to learn here. Last week, I had what seemed to be a simple join of three data sets. My permutation was a lot more complicated than … Continue reading

Posted in MS SQL, Transact SQL | Tagged , , , , , , , | Leave a comment

Find DTS and FTP Job Steps From msdb

I started a new full-time contract this month, which is always weird. Not having a full understanding of the project, access rights roadblocks, and unfamiliarity with the code base all team up to make days feel long and unproductive. One … Continue reading

Posted in MS SQL | Tagged , , | Leave a comment

Logical Tests Using OR in Crystal Reports

Consider these two formulas in Crystal Reports:


[/crayon] One would think that these two should behave the same, right? In fact, the results are different if Table.Value is null. In the first case, “if isnull({Table.Value}) gets evaluated first. Since … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , | Leave a comment

Update Across Joined Tables in MySQL

I had to do a MySQL update on records that were retrieved from a two-table join today. I shouldn’t have been surprised to find that I needed a different syntax than I know from MS SQL, where I would write, … Continue reading

Posted in MS SQL, mysql, Transact SQL | Tagged , , , , | Leave a comment

Take Control of Mac File Paths

Since I added a Mac to my repertoire of workstations, I’m getting better and better about finding quick and easy ways to get around. Sooner or later, I’ll be just as efficient on my Mac as I am on my … Continue reading

Posted in Apple, OS X | Tagged , , , , , | Leave a comment

Easy Foreign Key Drop and Restore for SQL Server

From time to time, we’ve all had a database query to run that was stymied by foreign key constraints. In my case, it was a request to restore a table’s values from one copy of the system to another. We … Continue reading

Posted in Database Design, MS SQL, Transact SQL | Tagged , , , , , , | Leave a comment

Assigning Variables When No Row Exists

A SQL Server tidbit that I never knew before today. This was a test on SQL 2000. I’d be interest to know if you get the same result on something more current. [Update: still just like this on SQL 2008] … Continue reading

Posted in MS SQL, Transact SQL | Leave a comment

Tracing MySql Transactions

Anyone who has had to troubleshoot or support systems built on a SQL Server database knows and loves the Profiler Tool, which allows you to see all of the queries submitted to a database. Web page database interaction tends to … Continue reading

Posted in Linix/Apache, mysql, php, Web Apps | Tagged , , , , , , , , | Leave a comment