Michael J. Swart

January 12, 2010

A puzzling situation…

Filed under: SQLServerPedia Syndication,Tongue In Cheek — Tags: — Michael J. Swart @ 12:01 am

A puzzling situation (my T-SQL Tuesday entry). This entry is an actual puzzle. Here I’m asking you to do the impossible (or at least the computationally difficult). Solve for ???:

Good luck

Good luck

Solution next week.

BTW, Don’t even try to attack this using a brute force approach. Even if you could test 1000 values a millisecond it would take like a whole decade to crack it.

November 4, 2009

Pros and Kahn

Filed under: Tongue In Cheek — Tags: — Michael J. Swart @ 1:03 pm

Pros and Kahn
Dumb pun. I’m at a conference at Seattle. These MVPs (minus Ricardo Manalban) are displaying the book they helped put together "SQL Server MVP Deep Dives" with profits going to the charity WarChild

October 27, 2009

Apology accepted

Filed under: Tongue In Cheek — Tags: , — Michael J. Swart @ 10:10 am

An open letter to delinquent SQL bloggers.

I accept your apologies which you thoughtfully expressed in posts such as here, here, here, here, here and here. You expressed desires to make amends and reconcile with me and I truly hope you were sincere.

I know that mistakes were made and there are regrets on both sides. But I think pointing fingers would be counterproductive at this stage.

So today, on behalf of SQL Blog readers, I hereby accept your apologies and forgive you all.

Together I think we can get through this difficult time. I think it’s best now if we focus on the present. And I think with patience, time and more consistent blog posts, I will not only forgive, but forget.

Sincerely,
Michael J. Swart
Database Whisperer

All kidding aside. It’s no biggie. I really never miss the lack of posts from any particular author in my RSS feed aggregator. I just mark such apology-posts as read and get on with the day.

August 10, 2009

Another LEFT JOIN example

Filed under: Technical Articles,Tongue In Cheek — Tags: — Michael J. Swart @ 11:22 am
A posting by Denis Gobo called Teaser: Left Join..the SQL ego crusher prompted me to write a query that illustrates what happens when a condition is placed in a LEFT OUTER JOIN’s ON clause versus when a condition is placed in a WHERE clause (SQL 2008 syntax):
DECLARE @strings TABLE (id INT IDENTITY(1,1), val NVARCHAR(MAX));
INSERT @strings(val) VALUES
   ('When using a left outer join,'),
   ('you'),
   ('put the condition'),
   ('in the outer join clause and not'),
   ('in the where clause. In effect'),
   ('all rows are returned and no'),
   ('filtering out '),
   ('is done.'),
   ('You can see that all rows are '),
   ('returned, both primes and'),
   ('non-primes');
 
DECLARE @primes TABLE (id INT)
INSERT @primes VALUES(2), (3), (5), (7), (11);
 
-- a query with a proper left join
SELECT p.id, s.val
FROM @strings s
LEFT OUTER JOIN @primes p
ON s.id = p.id
ORDER BY s.id;
 
-- a query with the condition in the where clause
SELECT p.id, s.val
FROM @strings s
LEFT OUTER JOIN @primes p
   ON 1 =1
WHERE s.id = p.id
ORDER BY s.id;

Kinda reminds me of those Mad Magazine fold-ins.

July 27, 2009

Deadlocks explained …

Filed under: Tongue In Cheek — Michael J. Swart @ 8:20 pm

… in comic form!

I also imagined a modern-day version: An episode of Law and Order - Deadlock Victims Unit where a profiler cracks the mystery.
You either get it or don’t.
BTW, I’ve got a new appreciation for Hagar the Horrible’s creator.

May 14, 2009

SQL Server 2008 R2

Filed under: Tongue In Cheek — Michael J. Swart @ 4:43 am
It was announced at Tech Ed that the next major SQL Server version (codenamed Kilimanjaro) will be called SQL Server 2008 R2. This surprised me. I would have bet that it was going to be called SQL Server 2010. 

http://www.sqlmag.com/Article/ArticleID/102089/102089.html

Microsoft marketing has to walk a fine line. On one hand, they want to placate any people who are nervous about upgrading to the first version of a major release. On the other hand, they want the products version name to announce that this is the latest and greatest.
Another danger is that in the future, I can imagine ridiculous names for particular versions: Imagine a CTP for SQL Server 2008 R2 SP3.
As for me, when SQL Server 2008 R2 comes out, I’m not going upgrade. I’m holding out for the version after that: SQL Server 2008 Threepio.

May 11, 2009

The Manga Guide to Databases?

Filed under: Tongue In Cheek — Michael J. Swart @ 10:34 am

Jeff James, Editor-in-Chief at SQL Server Magazine, mentioned a particular guide in the “New Products” section of the May 2009 Issue.

This guide is called the the Manga Guide to Databases and there’s no hint of sarcasm or satire here. Follow the link for a better idea of what this book is about. Here’s a sample from their promotional material copy: 
Want to learn about databases without the tedium? With its unique combination of Japanese-style comics and serious educational content, The Manga Guide to Databases is just the book for you.
Whew! So here’s my question… Who is this book for? What demographic are they aiming at? If you think it’s you, then let me know in the comments. Tell me what about this book appeals to you. If you don’t think it’s you, then hazard a guess in the comments.

April 22, 2009

More SQL Server Jargon

Filed under: Tongue In Cheek — Tags: , , , , , , , , — Michael J. Swart @ 9:13 am

In this post, I mentioned some of the more interesting acronyms or abbreviations that I’ve come across like:

  • Upsert
  • SARGable
  • HOBT and
  • QBERT

Here’s a few other interesting ones that I forgot to mention:

  • SProc : Short for stored procedure. I like this one, it’s fun to say out loud. The term is pretty ubiquitous, but I still make a conscious effort to say stored procedure when dealing with folks who might not know the term.
  • (S)GAM: These stand for (Shared) Global Allocation Map. You’ll come across these only if you’re really really interested in the guts of SQL Server. Thankfully, I’ve never felt the need to try to prounounce it.
  • CRUD: Stands for Create/Read/Update/Delete. These terms are analogous to INSERT/SELECT/UPDATE/DELETE respectively. I kind of like using the term, especially on grumpy days, but I use the DML acronym more often.
  • LOB (or better BLOB): This stands for (Binary) Long OBject. I can’t imagine how I missed this one the first go around. I love this acronym. Mostly because a blob is a great metaphor for what a Binary Long Object is.

March 12, 2009

SQL Server Jargon

Filed under: Tongue In Cheek — Tags: , , , — Michael J. Swart @ 9:07 am

SQL Server has its own share of jargon. Some cool sounding words, some not so much.

Here are some words that you will never hear me pronounce:

  • UPSERT a portmanteau of update and insert. There’s just something that seems wrong about the sound of it. So if pressed, I’d use the full phrase, “insert or update”. With SQL2008’s new MERGE command, hopefully I’ll have less of a need to.
  • SARGable a contraction of Search Argument Able. For example “The query is not sargable because the where clause has an expression in it that contains a function.” Again, I just don’t like the sound of it. Unfortunately, it’s hard to come up with a better word and so a phrase has to be substituted as in: “The query needs to perform a scan because the where clause contains a function”.

Here are some words that I am always looking for excuses to pronounce.

  • HOBT an acronym of Heap or B-Tree. Essentially it’s the name given to the physical structure of every index or table. Microsoft explains it better than I can. It shouldn’t be too hard to guess why I might like the word. I’m a fan of the book. In fact, fellow Canadian blogger Aaron Alton writes a (high quality) blog called the HOBT.
  • Q-BERT Okay, this one really isn’t an existing acronym for any SQL Server related term, but that doesn’t mean it couldn’t be in the future. Maybe one of the following could catch on:
    • Query BEhaviour Research Tool (instead of DB Engine Tuning Advisor maybe)
    • Quality Backups Ensure Robust Tables (more of a principle or saying)
    • Queries Bomb: Estimated Rowcount Terrible (time to update those stats!)

I’m sure you can think of a few of your own. Email me or comment if you have pet words (or pet-peeve words).

February 6, 2009

Something Pretty

Filed under: Tongue In Cheek — Michael J. Swart @ 7:46 am

A T-SQL script I came up with that displays the Mandelbrot set. (Tip: Hit Ctrl-T before executing)

SET NOCOUNT ON;

--populate
;WITH Numbers ([row]) AS
(
   SELECT TOP 100 CAST(ROW_NUMBER() OVER (ORDER BY NEWID()) AS FLOAT) [row]
   FROM sys.columns
)
SELECT A.row AS x, 
   B.row AS y, 
   0 AS iter, 
   A.row AS iterx, 
   B.row AS itery, 
   '.' AS symbol
INTO #GRID
FROM Numbers A, Numbers B
WHERE B.[row] <= 24
GO

-- scale
UPDATE #GRID
SET x = x * 3.0 / 100.0 - 2,
   y = y * 2.0 / 24.0 - 1,
   iterx = x * 3.0 / 100.0 - 2,
   itery = y * 2.0 / 24.0 - 1
GO

--iterate
UPDATE #GRID
SET iterx = iterx*iterx - itery*itery + x,
    itery = 2*iterx*itery + y,
    iter = iter+1
WHERE iterx*iterx+itery*itery <= 2*2
GO 257

UPDATE #GRID SET symbol = CHAR(64+(iter%26)) WHERE NOT iter = 257
GO

--print
WITH concatenated (y, c) AS 
(
   SELECT G2.y,
       (SELECT SUBSTRING(G.symbol, 1, 1) AS [data()] FROM #GRID G WHERE G.y = G2.y FOR XML PATH('')) c
   FROM (SELECT DISTINCT y FROM #GRID) AS G2
)
SELECT REPLACE(c, ' ', '') FROM concatenated ORDER BY y
GO

DROP TABLE #GRID

Wikipedia’s entry on the Mandelbrot set.

« Newer Posts — Older Posts »

Powered by WordPress