Michael J. Swart

September 2, 2011

Me and My Big Mouth (Literally)

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

This caption needs to be better.

I First Learned About SQL as a Speaker

One of my jobs in University was to tutor first year computer science students. My friends would tease me and call me a “computer tutor” in a really nasally voice. But it was a good job and a good experience.

I did a large variety of things in that job. I did the usual things like running tutorials, marking papers, and helping students with their assignments. But I also gave campus tours and I gave workshops to other students.These workshops were very very brief introductions to various computer science topics.

I was assigned to give one of those workshops on the topic of something called SQL. It was the first time I had ever encountered anything database related and I was supposed to teach it! I had never even seen the word SQL before and it was years before I got used to pronouncing it sequel instead of ess cue ell. I was nervous then, but I don’t think I needed to be. I learned enough about that subject to teach it well and the preparation paid off. That experience made me comfortable around SQL and when I encountered this “database language” again, I found it easy to pick up where I left off.

During that job, I didn’t learn a lot about computers that I didn’t already know, but I did learn a  lot about speaking and teaching. I learned how tricky it was to pace yourself. If you talk too quick, the subject matter goes over everyone’s head. Speak too slow and it sounds like you’re condescending and talking down to people.

I still like talking about SQL Server. At work, I often give lunch-and-learns. These are lunch-hour talks put on by coworkers for coworkers to talk about standards or to teach something that needs explaining. In the past few years, I’ve learned a lot about web development and I hope my colleagues have learned a bit about databases.

In general, I think public speaking is a good skill to have. Some are naturals (or seem to be) and others (like me) need the practice. So having said that …

I’ll Be Giving My First Talk at SQL Saturday #93 in Toronto

And so I’m super excited about giving a talk at SQL Saturday #93 in Toronto (September 17, 2011). SQL Saturday #93 is a free one-day workshop for SQL Server. (Register here!). The talk I’m going to give is called Obliterate Excessive Blocking and Deadlocking As a DB Developer, I think avoiding blocking is one of the most valuable skills to have. I’ll advertise this talk a bit more in a blog post next week. In the meantime…

Name that Caption!

That creepy picture of me up there is screaming for a better caption. Let me know your ideas in the comments, or put it in a tweet (@MJSwart). Let me know by the end of Wednesday (Sept. 7th). I’ll pick my favourite and let you know on Thursday!

June 22, 2011

Midyear Resolutions

Filed under: Tongue In Cheek — Tags: , , — Michael J. Swart @ 12:00 pm

So it’s been about half a year since Jen McCown invited SQL Bloggers to post their new years resolutions. I made mine and I’ve kept up with it, but I’m going to reassess that resolution now.

If you remember, my resolution was to blog once a week (with articles to go live every Wednesday at noon), keep to technical content, and include an illustration with each post. Check, check and check. My goal was to get 4 times as many readers than the previous year.

Well, I’m not quite there. Google Analytics tells me I’m at 3.3 times as many readers as the first half of 2010 …  So what do I need to do to get to 4.0?

Some ideas that came to mind were:

  • I could post five or six times a month instead of four. Going for volume.
  • I could focus on plugging my site in other places.
  • I could participate in every meme monday, t-sql tuesday and un-sql friday out there.

But none of those are appealing. Those thoughts don’t light a fire under me. So I’m going to say “You know what? 3.3 is good enough“.

So what does light a fire under me?

  • Writing about SQL
  • Drawing stupid illustrations.

I’m Giving Up My New Year’s Resolution

So I’m giving up the goal of the resolution, but I’m not changing my blogging habits… At least not too much. You’ll notice this post still got posted on a Wednesday at noon.

In The End It Wasn’t About Readership

Besides, I’ve realized that it’s not really readership I was after, it was the commenters! (Commenters! Commenters! Commenters!). The lurkers can continue lurking, but I’d rather have 10 comments on a post than 10,000 page views. The feedback is really good to have and I’m happy with that.

And to other bloggers out there, I suspect that you feel the same. My guess is that you’d prefer ten new active readers versus ten thousand new passive readers.

An Illustration

So I’m breaking my own rules. This isn’t a technical post and the illustration here has nothing to do with the subject of this post. So why do I include an illustration of Wicket Baggins here?

Because I can!

April 13, 2011

Whew… Microsoft Certification Exam 70-433

Filed under: SQLServerPedia Syndication,Technical Articles,Tongue In Cheek — Tags: , , , — Michael J. Swart @ 12:00 pm

Yesterday was April 12, 2011, and as far as I know mainstream support for SQL Server 2005 ended. See Aaron Bertrand’s A Quick Note About SQL Server 2005 Mainstream Support.

And if you care, this also means that the Microsoft Certifications that are tied to that product also expire. At least that’s what I gather from this Microsoft FAQ which says:

Q. How long will my certification be valid?
A. Today, most of our Microsoft Certified Technology Specialist (MCTS), Microsoft Certified IT Professional (MCITP), and Microsoft Certified Professional Developer (MCPD) exams retire when Microsoft discontinues mainstream support for the related technology…

But that’s just the exam, I’m not too sure about the certification. In any case it really doesn’t matter at all. I mean, the skills a person has with SQL Server does not diminish or become obsolete with the expiration of SQL Server 2005. SQL Server 2008 and other versions are still alive and kicking.

Bad News: So my MCTS (Microsoft Certified Technology Specialist) certification for SQL Server 2005 expired yesterday (don’t worry I’ll get over it).
Good News: My MCTS certification for SQL Server 2008 takes effect last Friday when I passed the 70-433 exam (yaay!!) It’s my first step towards a new certification for myself, the MCITP (IT Professional).

It was a decent exam, I thought it was fair. There were a couple of things I would have changed:

  • I found at least four typos in the questions and at least once I had to answer the question they meant to ask not the question they actually asked.
  • Two thirds of the way through the exam, there was a power outage. No one could have foreseen it, but I was glad to discover that my questions weren’t lost and the time without electricity was not on-the-clock.

Section 5, My Nemesis

I did well in every section except one, Working With Additional SQL Server Components. In that section I got two questions correct out of six. I guess I should have given more focus to it while studying. To be honest, I didn’t actually work the plan I wrote out for myself for that section. I had heard scary things about some of the other sections and focused on them. But even so, two out of six is pretty rotten for a multiple choice test. Random guesses might have even fared better. A lucky monkey has a good chance (46%) of doing at least as well or better than I did simply by throwing darts randomly as a strategy for choosing answers.

A picture of a monkey with holding a dart.

My 70-433 Study Plan

Of course I can’t give details about the content of the exam for obvious reasons, but I do want to share the study plan I followed when studying for this exam. I wrote the plan based on Skills Measured as described by Microsoft. Everything I write here can be found online:

Tables and Views

  • What does with CHECK OPTION mean when creating views
  • What does with ENCRYPTION mean when creating views
  • what’s the syntax for fill factor?
  • write (without checking syntax) a nci with fill factor
  • rebuild an index (without checking syntax) with a fillfactor
  • create statistics without checking syntax
  • add a pk (without checking syntax)
  • add a fk with cascading deletes
  • disable/enable pk
  • disable/enable check
  • disable/enable fk
  • disable/enable unique
  • Create table with column that has filestream
  • create a spatial column (without checking)
  • What’s a structured vs semi-structured column?
  • name collation varieties (case sensitive etc…)
  • Create partitioned table (without checking syntax)
  • Split merged table into two, merge back together
  • Create empty table and switch into partition

Programming objects

  • Without checking syntax, pass in a tvp
  • without checking syntax, write sprocs with all varieties of “Execute as”
  • Without checking syntax, create sproc that specifies RECOMPILE
  • Without checking syntax, create sproc that specifies WITH ENCRYPTION
  • What permissions are there on sprocs? 2 flavors of security here: GRANT, DENY, REVOKE versus EXECUTE AS
  • Build Function without checking syntax
  • What permissions are there on udfs? flavors of security here: GRANT, DENY, REVOKE versus EXECUTE AS
  • What is schemabinding on udf?
  • what are the three (four?) kinds of functions
  • Explore flavours of triggers.
  • Create trigger that uses INSERTED/DELETED
  • Explore security on triggers, (EXECUTE AS)
  • Create DDL trigger.
  • Create DDL trigger that returns data.
  • Create CLR assembly.
  • Explore clr: SAFE/UNSAFE/EXTERNAL_ACCESS
  • Explore CLR: set trustworthy
  • Implement TRY CATCH RAISERROR
  • error handling, look at Rusanu’s service broker scripts, he’s an awesome error handler.

Query Fundamentals

  • Explore different DELETE syntax (i.e. DELETE A FROM A…)
  • Without checking syntax, use the OUTPUT clause
  • Without checking syntax, use the MERGE statement
  • Write a query that uses grouping sets.
  • What’s the difference between LEN and DATALENGTH
  • without checking syntax, use patindex and charindex

Additional Query techniques

  • write a subqueries (correlated)
  • write a subqueries (simple)
  • write a subqueries (scalar)
  • write a subqueries (list)
  • write a subqueries (table valued)
  • Without checking syntax, Use rank
  • Without checking syntax, Use dense rank
  • Without checking syntax, Use row_number
  • Without checking syntax, Use ntile
  • Without checking syntax, Use row_number, and partition by
  • look through table hints to understand any unused ones
  • look through query hints to understand any unused ones
  • manage collations? how can they be managed.
  • what’s the diff between column/db/server collations
  • (international) define custom errors

Other SQL Components

  • Set up db mail
  • implement full text search
  • full text: Use CONTAINS
  • full text: Use CONTAINSTABLE
  • full text: Use FREETEXT
  • full text: Use FREETEXTTABLE
  • full text: Use STOPLIST
  • Use powershell and smo to create .net cmdlet demonstrates smo
  • Take service broker tutorial, compare sample syntax to rusanu’s syntax
  • Implement change tracking
  • Create db audit spec
  • Use CHANGETABLE

XML Data

  • use each FOR XML type
  • without checking syntax, use OPENXML, and sp_XML_docs
  • without checking syntax, shred xml.
  • review xpath syntax
  • what’s the difference between xquery and xpath?
  • Read through books online topic on xml

Gathering Perf Info

  • Use SHOWPLAN to (showplanxml?) to look through query
  • look at how paul (@sql_kiwi) displays query plan
  • Run through DTA, Prepare a workload <– remember options in DTA here!!!
  • Review catalog views. (Is this INFORMATION_SCHEMA?)

March 30, 2011

Something Light-hearted.

Filed under: Miscelleaneous SQL,Tongue In Cheek — Michael J. Swart @ 12:00 pm

So it’s April Fool’s day later this week and instead of trying to pull something over on folks, I thought I’d just do something light-hearted. So nothing super technical this week. Just plugged in my electric pen and …

How Most DBA Romances Start

Princess Bride spoof

SQLololo

Trololo guy

On Twitter Last Night

@MJSwart: I need one more SQL comic to draw. Ideas? (You give the idea, I give the drawing and the credit)
@BrentO: I like to think of the Resource Governor as Colonel Sanders. ;-)
@MJSwart: Done and done! Stay tuned.

… Here you go Brent
Colonel Sanders spoof

Bonus cartoon

For a nifty bonus cartoon just press F13 (This works on most browsers).

March 2, 2011

Mandelbrot Revisited.

Filed under: SQLServerPedia Syndication,Technical Articles,Tongue In Cheek — Tags: — Michael J. Swart @ 12:00 pm

So I caught some sort of flu bug recently and that means no new blog post this week. Instead, I’m going to dig through the archives to bring something that you may have missed the first time around.

Today I’m sharing something I first posted two years ago: Something Pretty.

Something Pretty

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

You’ll get something like the following:

@@@@@@@AAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCDDDDDEFFGILWLIGFEDDDCCCCCCCBBBBBBBBAAAAAAAAAAAAAA
@@@@@@AAAABBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCDDDDEEEFJMESD..NXMNHEDDDDDDCCCCCBBBBBBBBBAAAAAAAAAAA
@@@@AAAABBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCDDDEEEEEFFFGHO.......GQHGFEEEEDDDDDCCCBBBBBBBBBAAAAAAAAA
@@@AAABBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCDDDDDEFNMQ.JHHIAPLEOPV....VPQMLJPQGFFFFHNEDCCBBBBBBBBBBAAAAAAA
@@AABBBBBBBBBBBBBBBBBBBBBBCCCCCCDDDDDDDDEEEFFHJR..HU...................XJLICTUAIEDDCCBBBBBBBBBBAAAAA
@@ABBBBBBBBBBBBBBBBBBBCCCDDDDDDDDDDDDEEEEEFHMJMQR............................OHFEDDCCCBBBBBBBBBBAAAA
@ABBBBBBBBBBBBBCCCCCDDEPHFEEEEEEEEEFFFFFGGILR.................................JGGFDDCCCBBBBBBBBBBAAA
ABBBBBBCCCCCCCCCDDDDEEFHQJJLIHIGMIHHGGGHHJR.....................................SKEDCCCCBBBBBBBBBBAA
BBBCCCCCCCCCCDDDDDDDEFFGHLW..WF...T.RPKJKNL....................................MJFEDCCCCBBBBBBBBBBBA
BCCCCCCCCCCDDDDDDEFGGGHKG..............UQG.....................................KGEDDCCCCCBBBBBBBBBBA
CCDDCCCDEEEEEEFFFGHJ@PRPC.....................................................KFEDDDCCCCCBBBBBBBBBBA
...........................................................................OJHFFEDDDCCCCCBBBBBBBBBBB
CCDDCCCDEEEEEEFFFGHJ@PRPC.....................................................KFEDDDCCCCCBBBBBBBBBBA
BCCCCCCCCCCDDDDDDEFGGGHKG..............UQG.....................................KGEDDCCCCCBBBBBBBBBBA
BBBCCCCCCCCCCDDDDDDDEFFGHLW..WF...T.RPKJKNL....................................MJFEDCCCCBBBBBBBBBBBA
ABBBBBBCCCCCCCCCDDDDEEFHQJJLIHIGMIHHGGGHHJR.....................................SKEDCCCCBBBBBBBBBBAA
@ABBBBBBBBBBBBBCCCCCDDEPHFEEEEEEEEEFFFFFGGILR.................................JGGFDDCCCBBBBBBBBBBAAA
@@ABBBBBBBBBBBBBBBBBBBCCCDDDDDDDDDDDDEEEEEFHMJMQR............................OHFEDDCCCBBBBBBBBBBAAAA
@@AABBBBBBBBBBBBBBBBBBBBBBCCCCCCDDDDDDDDEEEFFHJR..HU...................XJLICTUAIEDDCCBBBBBBBBBBAAAAA
@@@AAABBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCDDDDDEFNMQ.JHHIAPLEOPV....VPQMLJPQGFFFFHNEDCCBBBBBBBBBBAAAAAAA
@@@@AAAABBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCDDDEEEEEFFFGHO.......GQHGFEEEEDDDDDCCCBBBBBBBBBAAAAAAAAA
@@@@@@AAAABBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCDDDDEEEFJMESD..NXMNHEDDDDDDCCCCCBBBBBBBBBAAAAAAAAAAA
@@@@@@@AAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCDDDDDEFFGILWLIGFEDDDCCCCCCCBBBBBBBBAAAAAAAAAAAAAA
@@@@@@@@AAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCDDDDEEFHNIHJREDCCCCCCCBBBBBBBBAAAAAAAAAAAAAAAAA

I’ll be back next week with something new, you have my word.

Gimli

... AND MY AXE!

January 11, 2011

My 2011 Resolution

Filed under: Tongue In Cheek — Tags: , , — Michael J. Swart @ 12:00 pm

T-SQL Tuesday LogoSo it’s T-SQL Tuesday time again! Thanks to Jenn McCown for hosting this month. Today we’re talking about resolutions. Quite apt for January I think.

Resolution time!

Michael J. Swart (looking introspective) resolves to be less introspective.

But seriously, What are my resolutions this year? My personal resolutions are personal (but fairly dull) and my work goals are exciting (but also private). So what’s left? Here it is, short and sweet:

I plan to blog more.

Hmm… that could have fit inside a tweet 7 times. I don’t think that’s quite gonna cut it for a blog post. Okay, Here’s exactly what I plan. I have a goal to get four times as many readers as 2010. It’s ambitious, but here’s some things that could help.

  • Write a post once a week with a post going live at Wednesday at noon. I haven’t been the most prolific and hopefully 2011 will be better.
  • Keep to technical content as much as possible (SQL Server Denali should be exciting).
  • Include illustrations when I can.

I like drawing. And I think I’ve improved enough that I can settle on a style. (one panel 300×500, reminiscent of Ripley’s Believe It or Not).  At best, I get a smash hit every month or two. At worst it’s a nice graphic that pulls people into the content.

November 7, 2010

Why Michael J Swart won’t be at the PASS Summit this year.

Filed under: SQLServerPedia Syndication,Tongue In Cheek — Michael J. Swart @ 11:45 am

Hiker looking for people at a mountain pass and mountain summit.

I get confused sometimes

But seriously, I went to my first PASS Summit a year ago and I had a blast. As much as I’d like to be in Seattle this week, it’s just not in the cards for me. But I look forward to following all the news via blogs and twitter and I’ll even catch some of the keynotes courtesy of PASS.

October 5, 2010

DBA humour

Filed under: Data Cartoons,SQLServerPedia Syndication,Tongue In Cheek — Michael J. Swart @ 9:44 pm

Data (Bass)

Data (Bass)

Data (Bass)

(Pun so intended)

May 7, 2010

SQL Self Portrait

Filed under: SQLServerPedia Syndication,Tongue In Cheek — Michael J. Swart @ 9:24 am

Something fun for Friday. I pulled out almost all the content for this post from the comment section of More images from the Spatial Results Tab.

The one thing that I learned (and might be news to you) is the reason that Microsoft’s spatial results tab has such bland faded colors. It turns out that these colors have a certain amount of transparency applied to them so on a white background, they seem faded. But this also means that overlapping colors are combined!

Overlapping colors

Overlapping colors in the Spatial Results Tab

And transparent colors means a larger palette to play with without using the more faded colors! So I first take this source photo:

Original

I reduce the color depth to the colors in my palette:

Reduced colors

and with C# and the usual magic I get:

SQL Self Portrait (Click to embiggen)

SQL Self Portrait (Click to embiggen)

With only six “polygons”. For the curious, the query itself is here but I’m warning you, uncompressed it’s 260 kb and it takes some time to run.

Happy Friday

February 17, 2010

More images from the Spatial Results tab

Filed under: SQLServerPedia Syndication,Tongue In Cheek — Michael J. Swart @ 1:00 am

Inspired by Itzik Ben Gan’s Geekiest Sig Challenge and Michael Cole’s virtual Christmas Card. I came up with a query that forces SQL Server’s spatial results tab to display something pretty. In recognition of Valentine’s Day, I chose a detail of Botticelli’s Birth of Venus.

The Query

The query isn’t too large, but it’s 120 KB, you can download it here:

http://michaeljswart.com/wp-content/uploads/2010/02/venus.sql

The Results

Not quite as pretty as the original

Not quite as pretty as the original

The Process

  • First reduce the color depth to a given color pallet (SQL Server’s icky pastels). I personally use a custom technique for this.
  • Use a program like Adobe Illustrator to turn into an svg file.
  • From there use your C# and VI savvy to convert into a SQL query.

Cheers guys

Older Posts »

Powered by WordPress