SQL SERVER – Identifying Deprecated SQL Server Features with Extended Events

In this blog post with the help of Extended Events, we will learn how to identify all the deprecated SQL Server Features. This feature can be very much handy when we are changing the compatibility of SQL Server and we want to check what are all the deprecated SQL Server features we are still using in our active code.

Identifying Deprecated SQL Server Features with Extended Events.

Let us see a very simple tutorial:

  1. Open the SQL Server Management Studio.
  2. Connect to the server next.
  3. Click the plus sign next to Management then click the plus sign next to Extended Events.
  4. Click on Sessions then right click on New Session Wizard
    New Session Wizard.
  5. At this point, the New Session Wizard screen should have launched. Once the New Session Wizard has launched, click Next.
    New session wizard introduction.
  6. Type “Deprecated and Discontinued” in the text box after session name and click Next.
    Set session properties dialog box.
  7. Choose the radial button  Do not use a template then click Next
    Choose Template Wizard.
  8. In the Event library text box type ‘deprecated’ and choose the deprecation announcement and deprecation final support events and then click the > arrow in the middle of the page to move them over as Selected events.
    Select Events To Capture dialog.
    New session wizard.
  9. In the Capture Global Events section check the following:
  • client_app_name
  • client_connection_id
  • database_name
  • nt_username
  • sql_text
  • username
    Set Session Properties.
  1. Then click Next
  2. On the Set Session Event Filters screen click Next. We are not filtering this Event Session.
    Set Session Event Filters.
  3. Check the top check box next to Save data to a file for later analysis Make the Max File Size 10 MB with Rollover files as 5.
    Specify Session Data Storage Window.
  4. Click Next.
  5. On the next screen, click Finish on the Summary
    New Session Wizard Summary.
  6. On the next screen click Close after the Event Session is successfully created.
    New Session Wizard.

Now let us run any deprecated feature in SQL Server and see the output. As I am using SQL Server 2017, I know that SET ROWCOUNT feature is deprecated in SQL Server 2017. Let us run the same command in SQL Server.

Next, change your focus to live data on the screen and you will be able to see that extended event screen will catch the deprecated event in the windows and display all the necessary information.

I guess it is very easy to know what are the deprecated features you are using across the database. We use this feature all the time during Comprehensive Database Performance Health Check.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

SQL Deprecated Feature, SQL Extended Events, SQL Scripts, SQL Server, SQL Server 2017
Previous Post
SQL SERVER – FIX: Arithmetic Overflow Error in Object Execution Statistics Report in Management Studio
Next Post
SQL SERVER – FIX: Error: 5511 – FILESTREAM’s file system log record under log folder is corrupted

Related Posts

1 Comment. Leave new

  • Thanks for this pinal, I have always used MDMA for that in the past, but its always nice to try a different way

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.