SQL Server 2012 introduces the IIF statement. It is very similar to the IIF statement in MS Access. I have extracted the IIF part of my presentation on Whats new in SQL Server 2012, and turned it into a video with a demo of how to use the IIF statement. The IIF statement is a quick shortcut to simple CASE …

SQL Server 2012 IIF Statement Read more »

One possible cause of the “Cannot resolve the collation conflict” error message is that your database collation doesn’t match the TempDB Collation. Recommendation It is recommended that the collation of your database match the collation TempDB.   It is possible that if your collations do not match that you may get errors, or that queries using TempDB will not run …

Cannot resolve the collation conflict Read more »

As shown in my previous posting on SEQUENCES, they are a user-defined object that generates a sequence of numeric values in Transact SQL 2012.  But what if you want to generate letters instead of numbers. Here is a code example of a sequence used to generate letters (indirectly). Which generates the following output. Just another cool trick with new features in …

TSQL 2012 – Generating letters with a SEQUENCE object Read more »

One thing that I end up having to look search on regularly is rounding of dates and times in Transact SQL, having looked this up too many times I finally realized that it is time for me to do my own blog post for it. First off, whats the difference between rounding and truncating in these examples. Rounding rounds to …

TSQL Rounding or Truncating DateTime to Nearest Day, Hour, Minute or Second Read more »

There are so many cool tools available today for data visualization.   This posting covers pulling data from the AdventureWorks2012 database running on SQL Server 2012, and then using the Google Visualization tools to display geographic data. The final outcome will the this map. People in the AdventureWorks2012 database. Here is how I did it. Step 1: Create a query …

Adventureworks2012 data to Google GeoChart Visualization Read more »

What a great day at  Code Camp today. Click here to download the slides and sample code from the presentations. The first presentation that I attended was  Accelerating your Development Workflow presentation by Ian Davis.  What a great presentation, it touched on the lean and agile development processes, it was very well done. The next one was a PowerShell presentation that …

Home after Seattle (Redmond) Code Camp 2012 Read more »

I am headed to Code Camp in Redmond WA today.  I ended up with 3 sessions that I will be presenting, and I am really looking forward to the day. I am looking forward to attending the Accelerating your Development Workflow presentation by Ian Davis. Here is what I am presenting… What’s New in TSQL 2012 This is the first time that …

Code Camp in Redmond Today— Read more »

In SQL Server 2012 there is a new function called CHOOSE that takes in an offset, and a list of options.  Choose is a function that returns the item at a specific index. Syntax: —CHOOSE(index, val_1, val_2, val_3, …) —If the index is greater than the number of values or less than 1 it returns NULL —Easier than using a …

TSQL 2012 CHOOSE Function Read more »