Internet Sellout

Demand Unearned Rewards

Dynamic SQL Pivot

This SQL is to demonstrate a dynamic pivot query. It is dynamic because the number of columns is not known in advance. Or because it is known but the number of columns is large but incremental. In this sample the pivot column is week of year.   SELECT * INTO #DATA FROM (SELECT CAST('Women... [More]

Moving MSSQL Databases to Different Partition

I just moved from one Rackspace cloud server to another. The main purpose was to get IIS 8 so I could do TLS/SNI. I got a skimpy partition for the system and the preinstalled SQL Server Web Edition databases were taking up precious space so I moved them with help from this article: http://technet.m... [More]

Tally Ho

CREATE FUNCTION [dbo].[ufn_TallyHo] (@quantity int) RETURNS TABLE AS RETURN( with cte(tally)as(select 1 union all select tally + 1 from cte where tally < @quantity)SELECT tally FROM cte ) I found a table at work called Tally that was a list of numbers. I thought it was sad until I needed ... [More]