This post is the second part of a two-part series on techniques for writing stored procedures. I’ve been mulling over this topic for some time, writing notes on occasion and trying to put some order around this topic… What I’d like to convey is not so much the “syntax” of writing stored procedures, but some… Continue reading Stored Procedure Techniques – Batch
This post is (hopefully) part one of a two-part series on techniques for writing stored procedures. I’ve been mulling over this topic for some time, writing notes on occasion and trying to put some order around this topic… What I’d like to convey is not so much the “syntax” of writing stored procedures, but some… Continue reading Stored Procedure Techniques – Online
On our project, I have started implementing a small design change; we will be phasing out the use of the DATETIME datatype and begin using DATETIME2 instead. Why? Please read one of the articles referenced at the end for technical specifics, but the summary is that 1) DATETIME2 is ANSI standard, and 2) Microsoft is… Continue reading Moving from Datetime to Datetime2
When developing T-SQL code for your application you often need to review the definitions of various database objects or search for dependencies in the existing objects and code to ensure that you are making the correct and complete set of changes for your requirements. SSMS is often a good tool for that and most objects… Continue reading Viewing Object Definition and Dependencies
I recently had a developer come to me with a “problem”; she said that she issued an UPDATE statement to update few records but the values didn’t change. I found that the UPDATE did take place. The issue was that the column was defined as DECIMAL(8,2), but her update statement was trying to change the… Continue reading Numeric Column Updates/Calculations
Conditional Joins…I don’t see much about this topic in cyberspace, but I occasionally run into performance problems with them. So this posting is all about them…or more specifically about why you should avoid them. A conditional join is a join (either inner or outer, by the way) that contains an “either-or” condition, easily identified because… Continue reading Should I use an “OR” in a JOIN?
Many developers find this topic to be mysterious or confusing. Let’s try to shed some light on this subject. What is a transaction and how is it managed in the database? Why is my connection blocking others (my T-SQL statements completed hours ago)? Simply put, from Microsoft’s .NET website: “A transaction consists of a single… Continue reading SQL Server Transaction Management