Home

Deprecated features should not be used

Description

    The SqlServer code rule "Deprecated features should not be used" states that any deprecated features of the SqlServer platform should not be used in code. Deprecated features are features that have been superseded by newer versions or features, and are no longer supported by the platform. Using deprecated features can lead to security vulnerabilities, performance issues, and compatibility problems, so it is important to avoid using them in code. It is also important to ensure that any code written is up to date with the latest version of SqlServer, as new features may be available that can improve the code's performance or security.

Key Benefits

  • No Unnecessary Risk: By avoiding deprecated features, you reduce the risk of running into unexpected issues or compatibility problems.
  • Improved Performance: New features are often designed to improve performance, so by using the latest features, you can take advantage of any improvements.
  • Easier Maintenance: By avoiding deprecated features, you can make your code easier to maintain and debug in the future.

 

Non-compliant Code Example

SELECT * FROM fn_servershareddrives();  --Non compliant code (Deprecated features is used)
DECLARE @ptrval binary(16);  
SELECT @ptrval = TEXTPTR(pr_info)   
   FROM pub_info pr, publishers p  
      WHERE p.pub_id = pr.pub_id   
      AND p.pub_name = 'New Moon Books'  
UPDATETEXT pub_info.pr_info @ptrval 88 1 'b';  --Non compliant code (Deprecated features is used)
DECLARE @ptrval binary(16);  
SELECT @ptrval = TEXTPTR(pr_info)   
FROM pub_info pr, publishers p  
WHERE p.pub_id = pr.pub_id   
   AND p.pub_name = 'New Moon Books'  
WRITETEXT pub_info.pr_info @ptrval 'New Moon Books (NMB) has just released another top ten publication. With the latest publication this makes NMB the hottest new publisher of the year!';  --Non compliant code (Deprecated features is used)
Visual Expert 2024
 VETSQLRULE29