RSS

Passed My Microsoft Certification Exam!

Today, I passed my first Microsoft Certification exam, MCTS exam 70-433!  With this certification, I am a Microsoft Certified Technology Specialist for SQL Server 2008 Database Development.

Getting a MS cert has always been something that I always wanted to achieve, but I never thought I would have the time to study.  Well I signed up back in April and just knew that if I didn’t just do it, I probably never would.  I had a great book to read from.  It included an application that simulated the exam with practice tests.  I took quite a few of the practice tests before the exam day and never could pass one, so needless to say, I was very nervous.

Once I was in the exam room, things seemed to get easier as I loosened up.  The questions were hard and quite a few were rather tricky.  Luckily, there was a review later checkbox at the top of each question that allowed me to go back after the test and review the ones that I was feeling unsure about.  That was the real key to passing, I think.  I went back through every question and re-read each word to make sure that I was fully understanding the question.  Honestly, I was able to change a few of my answers because of it.

All in all, I would definitely do it again.  In fact, I am already thinking about my next cert.  But I think I’ll take the summer off to relax before I dive into that study mode again.

 
Leave a comment

Posted by on May 26, 2010 in Certification, SQL Server

 

The Book of Red Gate

I’m a pretty big fan of RedGate.  I use a few of their products almost religiously.  Their SQL Compare product is probably the most used tool in my toolbox.  I follow their blogs & evangelists, regularly consume their free eBooks, and generally admire the company as a whole.  Their “Ingeniously Simple” mantra is really what keeps me coming back.  I even started to apply for a job there once.  However, the small requirement to live in England killed it for me.  So it’s no surprise that I would read The Book of Red Gate.

It’s not so much a book, as it’s a compilation of all things that RedGate represents and the day-to-day nuances that is RedGate.  It’s also the quickest 76 pages that I’ve ever read.  All in all, it’s a fun short book that is an insight to what goes on around the RedGate campus.

You can download a pdf version of the eBook here.

 
Leave a comment

Posted by on May 5, 2010 in Books

 

Free eBook: Introducing Microsoft SQL Server 2008 R2

Microsoft Press has released a free ebook: Introducing Microsoft SQL Server R2, by Ross Mistry and Stacia Misner. There are 10 chapters and 216 pages. Here is a quick overview of the chapters:

Chapter 1: SQL Server 2008 R2 Editions and Enhancements
Chapter 2: Multi-Server Administration
Chapter 3: Data-Tier Applications
Chapter 4: High Availability and Virtualization Enhancements
Chapter 5: Consolidation and Monitoring
Chapter 6: Scalable Data Warehousing
Chapter 7: Master Data Services
Chapter 8: Complex Event Processing with StreamInsight
Chapter 9: Reporting Services Enhancements
Chapter 10: Self-Service Analysis with PowerPivot

You can download the ebook in PDF format here.

Update your readers to follow my new syndication feed at http://feeds.feedburner.com/adamhutson.

 
Leave a comment

Posted by on April 26, 2010 in Books, SQL Server

 

Using FeedBurner Now

I have moved my syndication feed over to feedburner. For those of you that are subscribers, please update the links in your readers. My new feed is http://feeds.feedburner.com/AdamHutson. I will be rolling out a new website in the near future and the old feed will no longer be active. I’ll send out a last post as a reminder when it’s officially closed. Thanks for understanding.

 
Leave a comment

Posted by on April 20, 2010 in Organization

 

First Microsoft Certification Exam

I’ve signed up to take my first Microsoft Certification exam. I will be taking the MCTS Exam 70-433: SQL Server 2008 Database Development exam. The date is scheduled for May 26th with 3 hours allotted. I’m hoping that it’ll be a breeze, since I’ve been writing TSQL for so long, but I’m still nervous.

The book I’ve been reading is from Microsoft Press: Microsoft SQL Server 2008 – Database Development Training Kit, by Tobias Thernstom, Ann Weber, Mike Hotek, and GrandMasters.  So far it’s a really quick read.  The part that I really like about this book is that there is a summary at the front of the book that states the exams specific objectives and where it’s located in the book.  There are also practice tests included for studying.

Wish me luck!

 
Leave a comment

Posted by on April 19, 2010 in Books, Certification, SQL Server

 

Seconds into DD:HH:MM:SS format

Got a fun requirement today. Using SQL, the developer needed to convert an integer representing seconds into the format of dd:hh:mm:ss. So 125 seconds would be 00:00:02:05.

I put together a quick script that creates a table variable, inserts some test values, and selects back out of it.

DECLARE @ADAM TABLE(sec INT NULL)
INSERT INTO @ADAM (sec) VALUES (125)
INSERT INTO @ADAM (sec) VALUES (3600)
INSERT INTO @ADAM (sec) VALUES (3605)
INSERT INTO @ADAM (sec) VALUES (60000)
INSERT INTO @ADAM (sec) VALUES (6000)
INSERT INTO @ADAM (sec) VALUES (600)
INSERT INTO @ADAM (sec) VALUES (86400)
INSERT INTO @ADAM (sec) VALUES (86405)
INSERT INTO @ADAM (sec) VALUES (172800)
INSERT INTO @ADAM (sec) VALUES (172860)
INSERT INTO @ADAM (sec) VALUES (172865)
INSERT INTO @ADAM (sec) VALUES (1234567)
INSERT INTO @ADAM (sec) VALUES (75654)
SELECT RIGHT('0' + CONVERT(varchar(6), sec/86400),2)
+ ':' + RIGHT('0' + CONVERT(varchar(6), sec % 86400 / 3600), 2)
+ ':' + RIGHT('0' + CONVERT(varchar(2), (sec % 3600) / 60), 2)
+ ':' + RIGHT('0' + CONVERT(varchar(2), sec % 60), 2)
FROM @ADAM

Results
-----------
00:00:02:05
00:01:00:00
00:01:00:05
00:16:40:00
00:01:40:00
00:00:10:00
01:00:00:00
01:00:00:05
02:00:00:00
02:00:01:00
02:00:01:05
14:06:56:07
00:21:00:54

 
Leave a comment

Posted by on February 17, 2010 in SQL Server

 

Free eBook: How to Become an Exceptional DBA

Brad McGehee is one of my more favorite authors of SQL literature. How to Become an Exceptional DBA is one of his more popular books.  It’s really a career guide for novice and experienced DBAs, alike.  It shows step-by-step methods for how to differentiate yourself from the crowd.  Most of it is common sense, but it’s a good reminder for how to be an exceptional DBA.

You can download a free pdf version of this eBook here.

 
Leave a comment

Posted by on January 18, 2010 in Books

 

Free eBook: Don’t Just Roll The Dice

One of the blogs that I follow is the Business Of Software, by Neil Davidson.  Neil is the co-founder and joint CEO of Red Gate Software and the organizer of the Business of Software conference.  Back in October, Neil released a free eBook, Don’t Just Roll the Dice.  It’s a useful, short book on how to price software.  It includes theory, practical advice and case studies so that software pricing isn’t a roll of the dice.

You can download a pdf version of the eBook here.

 
Leave a comment

Posted by on December 17, 2009 in Books

 

Free eBook: Getting Real

37signals is one those companies that you just can’t help but notice.  And once you do, you won’t be able to keep from following them and their philosophies.  They are the guys that invented Ruby On Rails.  They follow the strict mantra that software products should be built with the least number of features possible.  Getting Real: The smarter, faster, easier way to build a successful web application is a new book written by the crew at 37signals.  This practical book details unconventional methods to deliver value, fresh perspectives, and inspiration.  At 200 pages, it’s a surprisingly quick read.  I read it the entire book from my iPhone while waiting at and in-between various appointments.  The book is made up of small essays that are easy to digest and understand.  It has amazing insight on building lean software that any starting company or entrepreneur will find immensely valuable.

You can view a web version of this eBook here.

 
Leave a comment

Posted by on December 3, 2009 in Books

 

Money vs DECIMAL data types in SQL Server

Last week, one of our developers asked us in the DBA group what our standard was for currency columns. My first thought was DECIMAL(19,4), but I couldn’t give a reason why it was standard. I knew MONEY was essentially the same definition, but had heard that it was dangerous to use. Suspecting a rounding issue, I began with a simple test.

DECLARE
    @dOne DECIMAL(19,4),
    @dThree DECIMAL(19,4),
    @mOne MONEY,
    @mThree MONEY
SELECT
    @dOne = 1,
    @dThree = 3,
    @mOne = 1,
    @mThree = 3
SELECT
    @dOne / @dThree * @dThree AS DecimalResult,
    @mOne / @mThree * @mThree AS MoneyResult

--------------------------------------------------------------------
DecimalResult  MoneyResult
1.000000       0.9999

Interesting! Why did the MONEY type get truncated? So another quick query gave me the output precision and scale.

SELECT
    SQL_VARIANT_PROPERTY(@dOne / @dThree * @dThree, 'basetype') AS DecimalBasetype,
    SQL_VARIANT_PROPERTY(@dOne / @dThree * @dThree, 'precision') AS DecimalPrecision,
    SQL_VARIANT_PROPERTY(@dOne / @dThree * @dThree, 'scale') AS DecimalScale,
    SQL_VARIANT_PROPERTY(@mOne / @mThree * @mThree, 'basetype') AS MoneyBasetype,
    SQL_VARIANT_PROPERTY(@mOne / @mThree * @mThree, 'precision') AS MoneyPrecision,
    SQL_VARIANT_PROPERTY(@mOne / @mThree * @mThree, 'scale') AS MoneyScale

-------------------------------------------------------------------------------------------
DecimalBasetype  DecimalPrecision  DecimalScale  MoneyBasetype  MoneyPrecision  MoneyScale
Decimal          38                6             money          19              4

The decimal is now a DECIMAL(38,6) and the MONEY is still a DECIMAL(19,4). Hmmm. Why did one change and the other didn’t change.

For an answer, I started digging into MSDN for precision & scale of data types. I came across this article. It had a fantastic table that described it.

Operation Result precision Result scale *
e1 + e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2)
e1 – e2 max(s1, s2) + max(p1-s1, p2-s2) + 1 max(s1, s2)
e1 * e2 p1 + p2 + 1 s1 + s2
e1 / e2 p1 – s1 + s2 + max(6, s1 + p2 + 1) max(6, s1 + p2 + 1)
e1 { UNION | EXCEPT | INTERSECT } e2 max(s1, s2) + max(p1-s1, p2-s2) max(s1, s2)
e1 % e2 min(p1-s1, p2 -s2) + max( s1,s2 ) max(s1, s2)

* The result precision and scale have an absolute maximum of 38. When a result precision is greater than 38, the corresponding scale is reduced to prevent the integral part of a result from being truncated.

So let’s expand on the first calculation, @dOne / @dThree * @dThree, which is actually two calculations, division and then multiplication.

e1 / e2 = DECIMAL(19,4) / DECIMAL(19,4)

precision = p1 – s1 + s2 + max(6, s1 + p2 + 1) = 19 – 4 + 4 + max(6, 4 + 19+ 1) = 43

scale = max(6, s1 + p2 + 1) = max(6, 4+19+1) = 24

So that leaves us with a DECIMAL (43,24) for the division portion, which is not a legal data type. So SQL subtracts 5 from the precision to get the 43 down to a 38, and a matching 5 from the scale, which leaves us with a DECIMAL(38,19).

e1 * e2 = DECIMAL(38,19) * DECIMAL(19,4)

precision = p1 + p2 + 1 = 38 + 19 + 1 = 58

scale = s1 + s2 = 19 + 4 = 23

This leaves us with a DECIMAL(58,23) which is also an illegal data type. So, again, SQL subtracts 20 from the precision to get the 58 down to a 38, and a matching 20 from the scale, which leaves us with a DECIMAL(38,3). But wait, there is an undocumented rule that if the scale is being lowered by this process, it is never lowered below 6. So we actually end up with a DECIMAL(38,6).

With the second calculation, @mOne / @mThree * @mThree, all of the results are cast back to a MONEY or DECIMAL(19,4) which truncates data and is why we lose the accuracy of our scale.

What did we learn, … Don’t use the MONEY datatype in SQL Server.

 
Leave a comment

Posted by on November 20, 2009 in SQL Server

 
 
Follow

Get every new post delivered to your Inbox.