• What is it that you're actually trying to do?

    Just so you know, the code you posted ran in 89ms on my desktop (not the fastest machine on earth either).

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning