CR0003: Non-ISO standard comparison operator found
Message
Non-ISO standard comparison operator found
Description
It is advisable to use ISO standard comparison operators instead of non-ISO standard operators to help ensure optimal cross-platform and future version compatibility.
- Not equal to: Use <> instead of !=
- Greater than or equal to: Use >= instead of !<
- Less than or equal to: Use <= instead of !>
While it is currently acceptable to use such non-ISO operators, you should consider that statements that you create might not be supported on other ISO-compliant database management systems.
Also, non-ISO standard comparison operators may not be supported on future versions of SQL Server.
Author
Phil Streiff
Example
-- Test Case 1: The violation should be reported SELECT Column1 FROM Table1 WHERE Column1 != 1 -- Test Case 2: The violation should be reported SELECT Column1 FROM Table1 WHERE Column1 !< 1 -- Test Case 3: The violation should be reported SELECT Column1 FROM Table1 WHERE Column1 !> 1 -- Test Case 4: A violation should not be reported SELECT Column1 FROM Table1 WHERE Column1 <> 1 -- Test Case 5: A violation should not be reported SELECT Column1 FROM Table1 WHERE Column1 >= 1 -- Test Case 6: A violation should no be reported SELECT Column1 FROM Table1 WHERE Column1 <= 1 [av_promobox button=‘yes’ label=‘Download’ link=‘manually,https://sqlenlight.com/downloads/cr0003.zip’ link_target=” color=‘theme-color’ custom_bg=‘#444444’ custom_font=‘#ffffff’ size=‘large’ icon_select=‘yes’ icon=‘ue82d’ font=‘entypo-fontello’ box_color=” box_custom_font=‘#ffffff’ box_custom_bg=‘#444444’ box_custom_border=‘#333333’ av_uid=‘av-2uxg9q’] Download and try the CR0003 analysis rule. [/av_promobox]