If you don't feel that you are getting helpful and comprehensive feedback from code reviews, it may well be your fault. Unless you are considerate to your reviewers in a number of ways, they might find it difficult to check your code and provide helpful advice. What ways? Michael Sorens outlines the eight golden rules that, if you follow them, might even even make your code a pleasure to review!
The process of doing SQL code-reviews used to be tedious and error-prone. Until SQL Enlight, it was a process that was difficult to automate for release and deployment. As it is now both a Command-line utility and an SSMS add-in, the database developer can see immediately the parts of the code that would raise eyebrows with the vigilant production DBA.
I get this error when trying to execute the following code:Server: Msg 245, Level 16, State 1, Line 7 Syntax error converting the nvarchar value 'Nancy' to a column of data type int.DECLARE @Name varchar(30), @Firstname varchar(30), @ID intSET @Name = 'y' -- 'y' = get info by firstname, 'n' = get info by employeeid […]
Here you want a member that has Activity code Coordinator and Business codes code1 AND code2. The way to do this is to LEFT JOIN to Business twice, in effect to two 'copies' of Business, once to look for code1 and once to look for code2:SELECT DISTINCT Member.id, Member.name FROM ((Member LEFT JOIN Activity ON […]