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.
Let us see a very simple tutorial:
- Open the SQL Server Management Studio.
- Connect to the server next.
- Click the plus sign next to Management then click the plus sign next to Extended Events.
- Click on Sessions then right click on New Session Wizard
- At this point, the New Session Wizard screen should have launched. Once the New Session Wizard has launched, click Next.
- Type “Deprecated and Discontinued” in the text box after session name and click Next.
- Choose the radial button Do not use a template then click Next
- 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.
- In the Capture Global Events section check the following:
- Then click Next
- On the Set Session Event Filters screen click Next. We are not filtering this Event Session.
- 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.
- Click Next.
- On the next screen, click Finish on the Summary
- On the next screen click Close after the Event Session is successfully created.
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.
Reference: Pinal Dave (https://blog.sqlauthority.com)