I’m going to try to post something that may be at least vaguely useful for somebody somewhere once per day from now on. Weekdays at least. I probably won’t get past #2, but let’s at least try…
Today’s tip helps you get random data from a SQL query. I remember being asked for this kind of thing back when we were using MSSQL 6.5, and you couldn’t do it. SQK2K (and probably 7 too), though, give us a nice easy way:
SELECT TOP 50 *
ORDER BY NEWID()
The NEWID() function returns a GUID, 128 bits of random loveliness, and it’s calculated for each row so ordering by it will produce a different order each time. Neat, huh?