Useful (?) Tip #1

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:
FROM    myTable
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?
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s