Rules
torsten.strauss
Posts: 271 Silver 3
Hi Red Gate Team,
I like the idea of code analysis rules and I know that I can decide to disable them if I like. Nevertheless I would not enable some of the rules by default.
For example:
ST011 Reason: Table variables do not provide statistics by default (you can enable by DBCC command but this is not a well known feature). Table variables are the better choice if you allocate one page only but otherwise consider to use temporary tables instead.
EI028 Resaon: I think you cannot always set a default for NOT NULL columns for several reasons.
PE008 : Reason: NOCOUNT is OFF per default, you do not even have to set it off.
PB009 : Reason : What is the reason for 1 or 2 bytes only?
PE027 : Reason: There are definitly situations you would recompile a procedure before each exection.
Additionally I perfer do avaiod abbreviations like the var and const in MI001, P017
It would be nice to get the rule identifier in the tool tip like P017 : ... to find the appropriate rule in the code rule overview in order to disable the rule on demand or even forever.
Thanks for your support!
Torsten
I like the idea of code analysis rules and I know that I can decide to disable them if I like. Nevertheless I would not enable some of the rules by default.
For example:
ST011 Reason: Table variables do not provide statistics by default (you can enable by DBCC command but this is not a well known feature). Table variables are the better choice if you allocate one page only but otherwise consider to use temporary tables instead.
EI028 Resaon: I think you cannot always set a default for NOT NULL columns for several reasons.
PE008 : Reason: NOCOUNT is OFF per default, you do not even have to set it off.
PB009 : Reason : What is the reason for 1 or 2 bytes only?
PE027 : Reason: There are definitly situations you would recompile a procedure before each exection.
Additionally I perfer do avaiod abbreviations like the var and const in MI001, P017
It would be nice to get the rule identifier in the tool tip like P017 : ... to find the appropriate rule in the code rule overview in order to disable the rule on demand or even forever.
Thanks for your support!
Torsten
Tagged:
Answers
On PE027, this is likely to occur, but much more likely is to focus on recompile on the statement level, that's why that recommendation.
I like the suggestion on disabling rules forever, because there are a few I'd disable as you do.
thanks for reply.
" You actually hurt yourself storing 1byte in a varchar field. That should be CHAR. It's equally slightly silly for a VARCHAR(2), but not as outright wrong"
I just asked why it is limited to 2 bytes:
I hope I calculated correctly ...
Should be 10 bytes:
Should be 10 cause you should use varchar if the length differs from 0(1) to 10. So in average you should see 5Bytes in varchar. That is the break even.
You have to look from the varchar perspective.