The SQL Server cheat sheet is a one-page A4 printable document, designed to provide a quick reference for SQL Server. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size SQL Server cheat sheet.
It's been a while since my last cheat sheet release. But what could be better than to get the ball rolling again with the most requested cheat sheet not yet created (until now) - SQL Server. Microsoft's database engine is the source of many arguments between developers, but whether or not you believe another database to be superior, SQL Server is undoubtably powerful and includes some great management tools (Enterprise Manager, Query Analyser and the more recent SQL Server Management Studio) missing from comparable technologies.
Data Types and Conversion
SQL Server supports a large variety of data types and good database design relies in part on using the right data type for the right column. This section lists the data types available in groups. I've also included the syntax for the CAST and CONVERT functions here for convenience.
Functions
SQL Server has a large array of built in functions of varying use. This section includes string, date, mathematical, grouping, ranking and table functions. Alongside the date functions block there is also a run down of the different "dateparts" - the characters used in date functions to denote different periods (day, week, month etc).
Creation
Finally (short description for this cheat sheet!), the third part of the cheat sheet contains sample code for the creation of stored procedures, views, triggers, indexes and functions (the last of which I don't make nearly enough use of).
Download
The cheat sheet is available in two formats, PNG and PDF:
And finally, if you like the cheat sheets, and want to say thanks, please consider buying me something from my Amazon Wishlist. Thankyou very much to those who have already hunted it down and sent me something nice - I'm very grateful!

54 Comments
Thanks for the new sheet! You're doing such a great job!!!
#1, Victor, Unknown, 20 July 2007. Reply to this.
Your site is very well done.
All Cheat Sheets are very good.
Thanks,
Pinal
#2, Pinal Dave, United States, 21 July 2007. Reply to this.
Thanks.
You have posted many, many useful cheat sheets. Thanks
#3, azar, Unknown, 21 July 2007. Reply to this.
when will you stop cheating?
seriously, you're doing a great job. thanks! :)
#4, insomnity, Philippines, 25 July 2007. Reply to this.
useful clean sheet, doing a good job
#5, seo training, India, 29 July 2007. Reply to this.
Nice! Thanks for sharing.
#6, NIL, Taiwan, 3 August 2007. Reply to this.
You should stop cheating :)
#7, Ali, Unknown, 6 August 2007. Reply to this.
A MYSQL cheat-sheet would be more useful. No one except worthless micro$oft fanboys care about MSSQL.
#8, jrgpmaster@gmail.com, United States, 11 August 2007. Reply to this.
jrgpmaster@gmail.com: Ummm. There is a MySQL cheat sheet.
Has it occurred to you that idiot comments like yours are one of the reasons that Open Source software has a hard time being taken seriously as an alternative to mature traditional software like SQL Server?
Anyone that knows me knows I am about as far from a Microsoft fanboy as you can get. And I still think SQL Server is awesome when coupled with PHP and run well. Especially on large scale sites.
Perhaps you should wait a few years (at least until you're in big boy pants) before joining in another discussion?
#9, Dave Child, United Kingdom, 11 August 2007. Reply to this.
To everyone else: Thanks :)
#10, Dave Child, United Kingdom, 11 August 2007. Reply to this.
Just recommended the cheat sheet to everyone at work.
Good work!
#11, Jane, United Kingdom, 21 August 2007. Reply to this.
Hi, just discovered your fabulous site yesterday. Just wanted to say many thanks for your great work you've put in the cheat sheets, those are realy great! Wanted to take a peek on the MS SQL sheet but I can't download it... Broken link? Anyway, realy great job! I like this fresh lay out, previews designs were nice too, but this one is the best one! Keep on the great work, thanks! I'll have to spend a couple of hours to read the articles, look sgreat!
#12, G0V., Belgium, 27 August 2007. Reply to this.
Sorry Gov - an .htaccess change broke the SQL links. All fixed now. Glad you like them, even when they're hiding :)
#13, Dave Child, United Kingdom, 27 August 2007. Reply to this.
Great work! I have been looking for something like this.
#14, Thomas Baekdal, Denmark, 31 August 2007. Reply to this.
The concept of cheat sheets is great, especially for people like me who keep on forgetting the essentials of a software and spend hours going throught the help files.
:)
Keep up the good work. and thanks to Ben Hunt for putting up a link on his website www.webdesignfromscratch.com through which I came here.
#15, Kulin, India, 3 October 2007. Reply to this.
Many thanks for all your contributions to the developer community!
One question about the SQL cheat sheet: When I click the PDF link, I only get the first page. I'd love to get the others as well! (Actually, I tried the MySQL sheet with the same result - only the first page comes up)
#16, Gordon K, United States, 25 October 2007. Reply to this.
Hi Gordon. The cheat sheets are single-page references. You're not missing anything - it's just the one sheet :)
#17, Dave Child, United Kingdom, 25 October 2007. Reply to this.
Great site - what a brilliant idea! Would also love to see a SQL Server cheat sheet aimed at more at DBA's than Coders (CREATE LOGIN syntax, FILEGROUPS, DMV's etc) - maybe you've just inspired me to make my own! Don't forget the separate DATE and TIME types coming with SQL Server 2008 (joy)!
#18, Simon Millar, Australia, 4 December 2007. Reply to this.
thanks a lot. it really helped me and is helping me everyday. I would like to get more on C# and asp.net.
#19, manas, India, 6 December 2007. Reply to this.
Great cheat sheet.
There is a misspelling of nchav - should be nchar in the PDF.
Thanks for the work.
#20, Kevin, Canada, 13 December 2007. Reply to this.
Wauw... great work!
This cheat sheet has helped me tremendously. Thanks!
#21, Dreamer, Unknown, 20 December 2007. Reply to this.
Okay, I have to admit that it's really amazing sometimes that what a simple idea could do to the world.
I am even believing now these cheat sheets that you have created contribute to the webdev community no less than those O'Reilly geeks....
#22, Yang, Australia, 30 December 2007. Reply to this.
Thanks a many, Keep up this good job, never mind if hits goes up after me referring to my friends and well wishers....Danaks
#23, Anandan, Unknown, 28 January 2008. Reply to this.
Thank you! Posted on my cubicle walls for my cheating pleasure!
#24, Darin, United States, 6 February 2008. Reply to this.
Cheat sheets can never go a-miss.
I also highly recommend for those linux boys out there to print of and get use to vim with a good quality cheat sheet.
The vim is my fav editor and with it being so integrated / easy to change with the linux cli, using the mysql / pgsql cli comes naturally..
Cheat sheets for all !!
#25, Chloe, Unknown, 14 February 2008. Reply to this.
thank you :) appreciate this much
#26, baliwebdesigner, Australia, 18 February 2008. Reply to this.
Can't wait to see what you come up with next!
You own dude!
#27, piles, United States, 21 February 2008. Reply to this.
Thanks for the work! I will print it and post in my wall :)
#28, Jordi Oller, Spain, 1 March 2008. Reply to this.
these cheat sheets are amazing man. keep 'em coming
#29, Anonymous, United States, 21 March 2008. Reply to this.
I appreciate the sheets. I had a bit of trouble finding the one I need, but the MSSQL sheet will make life easier for me.
Thank you.
#30, Daniele, Unknown, 16 April 2008. Reply to this.
Yes, all sheets are really useful.Go ahead with new sheets.
#31, Samir Sood, India, 17 April 2008. Reply to this.
Hi Dave,
I have all your cheat sheets in my desk always. I like to say my heartfelt thanks for your smart thinking and the effort you taken for the same to help people like me.
Is is possible to have a cheat sheet for .net (especially for me I need for 2003, framework, C#, VB and ado.net).
If you have in your collection, can you able to share with me?
Thanks in advance.
Hari Haran.R
Yours,
one of your site user
#32, Hari Haran, Unknown, 29 April 2008. Reply to this.
Good stuff. Remember when we were punished in school for having these? Cheat sheets rule, thanks.
#33, Todd, Unknown, 6 May 2008. Reply to this.
Its a really very useful article, most of your cheat sheets are on my desk.
Most of the time I use the CSS, SQL, Regular Expressions, Javascript,
Please post the Some .NET Cheat Sheet, if you have any.
I would like to share one provided by microsoft through my blog
http://www.dotnetglobe.com/2008/05/net-framework-35-namespaces-poster.html
#34, Brij Mohan, United Kingdom, 15 May 2008. Reply to this.
I have corrected the typo in the cheat sheet - "nchav" is now "nchar".
#35, Dave Child, United Kingdom, 30 June 2008. Reply to this.
Is it possible to have some kind of version/date numbering in the sheets ?
Then you can always compare with your local version of the sheet.
#36, Tomse, Denmark, 30 June 2008. Reply to this.
Hei guys...
take attention because in MsSQL the UTC Date function is GETUTCDATE and not GETUCDATE!!
I think this is only a typing error.
Good Job!!!
#37, Roberto, Unknown, 5 August 2008. Reply to this.
Well spotted, Roberto, and thanks for the heads up. I've fixed the typo.
#38, Dave Child, United Kingdom, 5 August 2008. Reply to this.
Great job, especially love the CSS cheat sheet, and the SQL Server one is pretty cool too. Can I point out a bug on the Sql Server sheet? Shouldn't that first panel be called "Data Types" or somesuch?
Keep up the good work!
#39, Dave Field, United Kingdom, 20 August 2008. Reply to this.
Thank you! I put it up in my office and use it everyday!
#40, Dave dream, United States, 10 October 2008. Reply to this.
Great help. Thanks!
#41, Devang Gandhi, United States, 10 October 2008. Reply to this.
lol, jrgpmaster@gmail.com got pwned.
#42, Joe Somebody, United Kingdom, 27 November 2008. Reply to this.
Great cheat sheets! I like their simplistic design, they don't feel overcrowded like some others.
#43, Max, Unknown, 12 December 2008. Reply to this.
Love the Cheat Sheets. I plan on printing them in color, laminating them and hanging them on my cube wall.
On the SQL Server sheet, it looks like the very first section, that should be "Data Types", is misnamed "String Functions"
#44, Erik, United States, 5 March 2009. Reply to this.
Thanks for the List. I have printed it an put it on the wall next to my computer. It can be a real pain to commit all of these to memory.
#45, Jonathan Gardner, Unknown, 14 April 2009. Reply to this.
Thanks for the list. Great job!!!! It's make my work day more easy!!!!!
#46, Marcelo, Unknown, 19 May 2009. Reply to this.
Great site. A co-worker passed it onto me and I gotta say I always have trouble remembering CAST & CONVERT syntax (normally end up looking it up from old projects I worked on). The Cheat Sheets are a great idea and will save me from having to dig through the documentation. Thanks allot!
#47, Kevin Baum, United States, 24 May 2009. Reply to this.
Thank you for providing valuable information here. More info on programming integration service (ssis), optimizing and monitoring tempdb for better performance and best practices for ETL and lots more tricks and tips regarding group by clause and etc. can be found on the below link.
http://www.sqllion.com
#48, SQL Lion, Unknown, 25 May 2009. Reply to this.
Great Job!
Extractable Knowledge BASEs
#49, kxsq, China, 28 June 2009. Reply to this.
You sir, win. Thanks for the hard work.
#50, kojul, United States, 2 October 2009. Reply to this.
If you decide to be selling all these cheat sheets, people will still but, because they are neatly presented in an understandable manner.
#51, Kyle, Ireland, 25 October 2009. Reply to this.
Hi, Isn't there an error in the Create a Function part of the cheat sheet. The SELECT statement doesn't seem to be ended to me.
Thanks
#52, Pradip, United States, 21 November 2009. Reply to this.
great work well done.
#53, Josh, 9 February 2010. Reply to this.
and thanks too.
#54, Josh, 9 February 2010. Reply to this.