The Guru's Guide to Transact-SQL

Ken Henderson

Mentioned 4

Since its introduction over a decade ago, the Microsoft SQL Server query language, Transact-SQL, has become increasingly popular and more powerful. The current version sports such advanced features as OLE Automation support, cross-platform querying facilities, and full-text search management. This book is the consummate guide to Microsoft Transact-SQL. From data type nuances to complex statistical computations to the bevy of undocumented features in the language, The Guru's Guide to Transact-SQL imparts the knowledge you need to become a virtuoso of the language as quickly as possible. In this book, you will find the information, explanations, and advice you need to master Transact-SQL and develop the best possible Transact-SQL code. Some 600 code examples not only illustrate important concepts and best practices, but also provide working Transact-SQL code that can be incorporated into your own real-world DBMS applications. Your journey begins with an introduction explaining language fundamentals such as database and table creation, inserting and updating data, queries, joins, data presentation, and managing transactions. Moving on to more advanced topics, the journey continues with in-depth coverage of: Transact-SQL performance tuning using tools such as Query Analyzer and Performance Monitor Nuances of the various T-SQL data types Complex statistical calculations such as medians, modes, and sliding aggregates Run, sequence, and series identification and interrogation Advanced Data Definition Language (DDL) and Data Management Language (DML) techniques Stored procedure and trigger best practices and coding methods Transaction management Optimal cursor use and caveats to look out for Full-text search Hierarchies and arrays Administrative Transact-SQL OLE Automation More than 100 undocumented commands and language features, including numerous unpublished DBCC command verbs, trace flags, stored procedures, and functions Comprehensive, written in understandable terms, and full of practical information and examples, The Guru's Guide to Transact-SQL is an indispensable reference for anyone working with this database development language. The accompanying CD-ROM includes the complete set of code examples found in the book as well as a SQL programming environment that will speed the development of your own top-notch Transact-SQL code.

More on

Mentioned in questions and answers.

I'm a pretty good C# programmer who needs to learn SQL Server. What's the best way for me to learn SQL Server/Database development?

Note: I'm a total newb when it comes to DB's and SQL.

One of the Best resources is Tons of articles

Another good resource is

And here is a list of books my DBA suggested I read for learning SQL

  1. Best Damn Exchange, SQL and IIS Book Period or on google books
  2. Beginning SQL Server 2008 Developers or on Google books

I tend to like books because I can read them anywhere, I can go at my own pace and I can get eBook copies (when using apress). I also happen to learn more efficiently in this manner as I already know most of the concepts, like database types.. int, bool, guid, etc... you will know those as well. So, essentially, I would recommend the apress series of books - very comprehensive IMO. And you can generally find them used for very cheap on Amazon... Here is one tailored to you:

In applying for jobs via agents I sometimes get blocked by an agent who says do you know software package X. When I reply that I know the similar package Y they might say unless you know X I cannot put you forward.

The problem is that some of these agents don't know what they talking about, they are merely being used by their clients as a screening filter.

It would be useful to be able to say to these agents that because I know Y I can expect to become reasonably proficient in X in a given number of days/months. However not knowing X determining the required time is why I'm asking this question.

Most recently X was Oracle and Y was SQL Server.

Please can those of you who know both, express an opinion on how long is required to become reasonably proficient? NB I'm not talking about becoming a DBA!

I went from SQL Server to Oracle in 2001 where I went from working on a VB6/SQL Server project (as a developer) to working as an Oracle development DBA for a large J2EE project. Here are the edited highlights of my experiences and some reflections.

For development, the basic principle of SQL is not radically differnt. T-SQL is a somewhat different beast to PL/SQL so the idioms are a bit different. Most competent programmers should be able to make the jump by just tinkering around and getting some good SQL server books such as the Guru's Guide or Oracle books such as Expert one-on-one Oracle, depending on which way you're going.

I'd say for a developer a week or two to get used to another database platform will get you most of the way there. The basic principles are fairly similar (modulo differences in the architecture); really only the window dressing is different. However, if you're going to Oracle, get a copy of a third-party query tool such as TOAD as these are much, much, much better than the ones that Oracle supplies.

Agents are notoriously bad for matching specific buzzwords and I get this on a semi-regular basis (I'm a contractor). If you need to bone up on SQL Server the Developer Edition is very cheap and will install on a desktop O/S such as Windows XP. Oracle also offers Free downloads for all their supported platforms that you can use to tinker.

You might also get some mileage from asking a stackoverflow question along the lines of "What are the main idiomatic differences between PL/SQL and T-SQL".

i'm looking for good books and tutorials about writing complex stored procedures along with common tricks and best practices commonly used by DBAs.

all i usually find is the basic SQL Statement tutorials , what i need are some good examples of Complex Data Selection along with common tricks of how to correctly and efficiently filter data for selection between multiple tables .

i release this is hard to find , because Complex DB's are usually built only in large projects and not for tutorials , but for the least i would like to find commonly used method applied by DBAs

thanks in advance.

You should look at The Guru's Guide To Transact SQL by Ken Henderson, a bit old, but probably still the best book about T-SQL :)

I am looking for good resources on Stored Procedures. Particularly for Microsoft SQL server 2005, but any overall good resources for SQL will do. These can be books, websites, etc.


A good advanced guide to T-Sql is "The Guru's Guide to Transact-SQL" by Ken Henderson. It's becoming kind of a classic.

I think this might be a good book. Just had a look on sample pages so don't have a deeper idea.

You may download the Ebook as well.

SQL Server 2000 Stored Procedures Handbook (Expert's Voice)