Like a lot of people within the SQL community, I can never read enough on the subject. Books, whitepapers, academic research and blogs can all be valuable source of information, so whilst browsing Amazon I found this book on a free kindle download. The preface makes some bold claims indeed :
“This book is for developers who already know SQL Server and want to gain more knowledge in SQL Server. This book is not for starter who want to start from the beginning.
The problem-solution approach will help you to understand and solve the real-time problems easily.
This Book will teach you (their emphasis)
The last bullet point, sets the tone of the quite appalling use of grammar (yes, yes , people in glass houses and all that.. ) contained throughout the entire book, I get that the authors may use english as a second (or third) language, but where are the proof readers ? That i can live with though, its the technical content i really have a problem with. Here is just a small selection:
Q 2) How to use GO statement in SQL Server ?
IMO, the most important concept to understand about GO is that it is not a SQL Statement. It is processed on the client (SSMS, ISQL etc) and splits the workload into separate batches. This is not mentioned here, though to be fair in Q3 (How to repeat the statements without using loops ?) the author notes “GO is a client command and not a T-SQL command". So GO or GO <N> can only be used with Microsoft SQL Server client tools.”.
Q 5) How to use ORDER BY clause in view ?
Here the author spends a great deal of time and effort working around “As per RDBMS rule ORDER BY clause is not allowed in view”. This section should be thrown away entirely, if you are depending on the view ordering ( which is a contradiction in terms) for your result set ordering you deserve all the law suits that are thrown at you.
Q 10) How to do case sensitive searches in SQL Server ?
The authors solution here is to cast a column as varbinary. OK, fair enough it works. Personally, i would have used COLLATE but lets not split hairs. The biggest issue i have here is sargability is not mentioned, we are introducing the possibility of a scan.
Q 12) How to solve server time out problem ?
The scenario presented here is that session #1 has updated some data that session #2 needs to read. The author presents 2 solutions NOLOCK and READPAST and ,to be fair, does make an attempt at highlighting the dirty reads. My issue here is that, once again, locking is seen as the enemy that must be worked around. We should embrace locks, understand why they are happening and how they are protecting us. The point is not raised that the fault here lies with the UPDATE’ing transaction not completing in a timely fashion, not that the reader cannot complete due to that. The consequences of reading and processing dirty data are not explored thoroughly enough and once again, NOLOCK is used as a “go faster” button.
Q 33 ) How to improve the performance of stored procedure ?
Here we have been given 11 bullet points by the authors , which I have copied verbatim below. My thoughts about each point are inlined in red:
And so it continues. I’m trying really hard to not be to scathing or nit-picky about this book, there is some good advice here, but SQL Server is full of caveats , confusing and contradictory best practices and ultimately 90% of the time you can state that “It depends”.
Questions are presented with solutions that can work but are given as 100% solutions not with any degree of warning that that may not always be the case. Even as a free download, it is way too expensive, and, remembering the target audience, could ultimately do more harm than good.