If you are in the Portland area, you won’t want to miss the OSQL-d meeting tomorrow. We have two great sessions planned.
Wednesday, Feb 11th, 2009 at 6:30 pm (Pizza and networking start at 6:00 pm)
Microsoft Portland Office – 10260 SW Greenburg Rd, Suite 600
Using SQL Server Management Studio, Intellisense, and SQL 2008 T-SQL Enhancements
Speaker: Buck Woody
Come hear Buck Woody, Microsoft’s “Real World DBA” as he explains the new enhancements in SQL Server Management Studio that will help you write better T-SQL code -faster. He’ll also cover some of the new Transact-SQL Enhancements. Come ready to learn and share!
http://buckwoody.com/BResume.html
Solutions to Vexing T-SQL Problems (Continued)
Speaker: Arnie Rowland
Time permitting, Arnie will continue a discussion on finding ordinary solutions to complex problems. He will be demonstrating several query problems that are often difficult to conceptualize, and providing code examples for the solutions. If you want to have your T-SQL code skills challenged and perhaps expanded, you will want to see this presentation.
Visit OSQL-d for more information.
I just stumbled across this Windows 7 feature. In the sound properties dialog there is now a Communications tab. Supposedly, it will detect when you are on an audio call and mute or reduce the volume of all other sounds. So far, I’ve tried Skype and Live Messenger and neither one caused the sounds to mute. I really like the idea though and hope to see it working in a later build.

Pinal Dave posted yesterday about how to solve the Fizz Buzz problem using T-SQL.
Definition of FizzBuzz Puzzle : Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
His solution works, but he is using procedural logic. Some of the biggest causes of performance problems in SQL Server are caused by application developers who try to use procedural logic instead of using the set-based logic that databases are meant for.
Here is how to solve the FizzBuzz problem using set-based logic in T-SQL:
WITH Numbers(Number) AS (
SELECT 1
UNION ALL
SELECT Number + 1
FROM Numbers
WHERE Number < 100
)
SELECT
CASE
WHEN Number % 3 = 0 AND Number % 5 = 0 THEN 'FizzBuzz'
WHEN Number % 3 = 0 THEN 'Fizz'
WHEN Number % 5 = 0 THEN 'Buzz'
ELSE CONVERT(VARCHAR(3), Number)
END
FROM Numbers
ORDER BY Number
Update 3/15/2010:
Here is another, much faster solution, taken from ideas I found here.
DECLARE @num INT = 1000000
SET STATISTICS TIME ON;
SET STATISTICS IO ON;
;WITH
L0 AS(SELECT 1 AS c UNION ALL SELECT 1),
L1 AS(SELECT 1 AS c FROM L0 AS A, L0 AS B),
L2 AS(SELECT 1 AS c FROM L1 AS A, L1 AS B),
L3 AS(SELECT 1 AS c FROM L2 AS A, L2 AS B),
L4 AS(SELECT 1 AS c FROM L3 AS A, L3 AS B),
L5 AS(SELECT 1 AS c FROM L4 AS A, L4 AS B),
Numbers AS(SELECT ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS Number FROM L5)
SELECT TOP (@num)
Number,
CASE
WHEN Number % 15 = 0 THEN 'FizzBuzz'
WHEN Number % 3 = 0 THEN 'Fizz'
WHEN Number % 5 = 0 THEN 'Buzz'
ELSE CONVERT(VARCHAR(7), Number)
END AS FizzBuzz
INTO #FizzBuzz
FROM Numbers
SET STATISTICS TIME OFF;
SET STATISTICS IO OFF;
--SELECT FizzBuzz FROM #FizzBuzz ORDER BY Number
DROP TABLE #FizzBuzz
The SQL Server Customer Advisory Team (SQLCAT) just posted a great article listing some of the best new SQL Server 2008 features for the DBA. Here they are:
- Activity Monitor
- SQL Server Audit
- Backup Compression
- Central Management Servers
- Data Collector and Management Data Warehouse
- Data Compression
- Policy-Based Management
- Predictable Performance and Concurrency
- Resource Governor
- Transparent Data Encryption
Read the full article.
I just read Brent Ozar’s post about Stack Overflow adding a “reputation bounty” for answering questions. Brent said:
Thank God they’re not using real money, only reputation scores. If they used real money, I’d probably stay up all night hitting refresh, waiting for new questions to come in.
Real money might not be such a bad idea. They could tie in to something like tipjoy and when people thought an answer was helpful, they could tip a small amount (maybe enough to buy the person lunch). I could see someone willing to toss out $100 or more, if they were under a deadline and working with a somewhat obscure technology. The biggest problems I see would be measuring the quality of the answer and collecting payment. It could be run similar to 99designs.
I just read Jason Massie’s new Capt. Varchar(MAX) comic. If you have spent much time interviewing SQL Server candidates I’m sure this will bring back some memories.
I was helping a company phone screens candidates for a Senior DBA position a while back. We went through such a bad string of candidates that the three of us started taking bets. Half way through each phone screen we would vote if we thought the candidate would know what the “DELETE <table>” statement was used for, loser bought the others lunch. The really sad thing was that these were supposed to be senior level candidates.
What’s your best SQL Server interview story?
For those of you interviewing for an IT job. Brent Ozar just posted The Top 10 Questions To Ask When Taking an IT Job.
I mentioned before that I was using an IIS7 shared plan on GoDaddy.com. Their shared hosting plans are supposed to support multiple domains. Unfortunately, they implement the domains using some kind of URL rewriting that conflicted with the URL rewriting I setup for WordPress. After trying several different configurations that resulted in my blog being down for an extended period of time, I decided it is impossible (or at least more painful then I wanted) for me to host multiple sites.
I really don’t like shopping for hosting companies, because there are so many of them and a lot of different feature combinations. I wanted one that ran Windows 2008 with IIS7, had support SQL Server 2008, as well as PHP and MySQL (for WordPress). It also had to be affordable. After looking around quite a bit I decided on SoftSys Hosting. The reviews online were mixed, with some people really liking them, and others complaining. It’s hard to know who to believe, because it seems like there are a lot of fake reviews on the sites in both directions. Time will tell how good they are.
I was playing around with Google Reader and found that you can publish a list of feeds in a specific folder. I thought it might be useful to share the list of SQL Server blogs I’m subscribed to. Since the list is being pulled from Google Reader is will stay up to date as I update my subscription list. If you see any good SQL Server blogs I’m missing, please let me know.
Here is a list of all the SQL Server blogs that I’m currently subscribed to:
If you are viewing this in Google Reader, or another aggregator that doesn’t support javascript, you can view the list here.