I taught myself the basics from a very old and now out of print book (and I still have the book). It's very well written with some pretty good basic exercises. The guy that introduced me to the book selected the chapters that I needed to read and none of those chapters included using Cursors or While loops except one and he told me to skip that section.
Here's the Google search for the book...
Most everything else was gleaned from SQLServerCentral.com and Simple-Talk.com. It's ironic that Red-Gate now owns both.
That's not to say that I didn't visit other sites. A lot of people provided links to other sites and I've read literally hundreds of other articles, not including the ones that I've read here. The biggest learning is frequently found in the discussions on the discussion threads for articles regardless of of which site you visit. I also use to haunt SQLTeams.com quite a bit because there were some good people there, as well.
Like I said in the article you read about me, I've found that reading and answering questions on forums was one of the best teachers for me. No where else will you get such a dizzying array of real world problems nor such a cornucopia of different solutions. Yes, there are some great people with incredible answers but it's equally (and perhaps more) important to read and play with the not-so-good solutions to understand why the good solutions are actually so good.
Above all else, the secret to my personal success has been the learned and self-enhanced ability to make shedloads (frequently, millions of rows) of Random Constrained Data that simulates real world problems instead of working with the proverbial 10 rows that a lot of people use. My take is that if it doesn't work properly and very quickly on a million rows, I need to try again until I can do it.
With the understanding that they provide an introduction rather than a complete set of possibilities (like the million row hierarchical table I included the code for in my "Hierarcchies on Steroids" articles or the CSV generator I built for the Tally-Oh! article on an enhanced splitting technique that has become popular), here are a couple of articles on that subject...
Being able to generate a lot of test data can really help you when you practice and help you learn that milliseconds do really matter.
Of course, not all that glitters is gold. For example, there are a whole lot of "Holy Grail" articles out there that come complete with a test data generator, a test harness, etc, etc, and strong words like claiming something is a "Best Practice" that can do a lot of damage to people's learning. Some are really good but some are really bad. For example, the ones that claim and supposedly prove that various forms of an "XML-based String Splitter" are a "good and fast" method are woefully incorrect because they used really crap methods for making test data that favors (super low cardinality) the XML method.
It's a pain and difficult to do but you have to learn that no matter how many people rave about an article in the discussion that follows an article, the article can still be totally wrong and will bonk you pretty good if you use the techniques from the article. If you see someone that claims to have written a good performance article that uses a Recursive CTE, a While loop, or GO xx to build test data, there's a high chance that you could do a lot better by finding a different article on the subject.
As with all else both in life and T-SQL/SQL Server, "It Depends" prevails and you have to learn what to look for and then practice like a madman (again, forums are a good source of problems to learn how to solve even if you don't want to post your solutions but should so you can get feedback on your solutions).
T-SQL is an "art" and really good T-SQL requires many "Black Arts" because the MS Documentation is going to have all the really good stuff in it. For example, no where in MS Documentation on T-SQL do they teach the importance of use of a Tally or Numbers table. Nowhere in the MS Documentation will you find the word "Pseudo Cursor". And nowhere in the MS Documentation will you find (as examples of what I'm talking about), a performance test on horribly slow FORMAT or a performance test on incremental Recursive CTEs, etc, etc. That's all up to you and the other people, books, and articles.
There's no way to learn it all nor learn a lot quickly. It's going to take patience and a lot of Googling and reading and building test data and writing code to try to solve solutions, etc. If you like T-SQL and databases, be patient... it's definitely worth it.
Sorry for the long winded reply but I'm "seeing a first glimmer" and want to help push you in the right direction if you like this business.
is pronounced "ree-bar
" and is a "Modenism
" for R
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
"Change is inevitable... change for the better is not".
"Dear Lord... I'm a DBA so please give me patience because, if you give me strength, I'm going to need bail money too!"
How to post code problems
How to Post Performance Problems
Create a Tally Function (fnTally)