T-SQL - Testing for specific versions of SQL Server

  • Hi all,

    I have been tasked with devising a plan for an upgrade of MSSQL 2005 to MSSQL 2016. Doesn't look without is challenges, least of all ensuring that all code will still work with all the deprecated features between 2005 and 2016.

    Apologies if this is a noob question, as my background is in dev, as opposed to administration so I don't have any experience in upgrades, but I wondered if there were any tools available to to check if code is compatible with a specific version, or if it points out which versions it will not be compatible with?

    As you can imagine, we have reams of stored procs, so just looking for the easiest way to check that these function, and wanted to check of there was another way, other than upgrading on a test box and setting them off to see.

    Appreciate any assistance.

  • Yes, please try the SQL Server 2016 Upgrade Advisor.

    John

  • Thanks very much, downloaded it and run it against a test database. 

    One thing I am a little confused around, if you can shed any light that'd be appreciated.

    Looking at this list:

    https://msdn.microsoft.com/en-us/library/ms143729.aspx

    A deprecated feature appears to be:                       

    A string enclosed in quotation marks used as a column alias for an expression in a SELECT list:

    'string_alias' = expression

    But if I write a stored proc:


    USE [Test_Database3]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[spCompatibilityTest]
    AS
    BEGIN
        SELECT 'Date' = GETDATE();
    END

    The data migration assistant doesn't pick it up as a potential issue, when the target version is set to 2016, on a 2008 database. Do you know how the deprecated features are managed? As another is:

    Not ending Transact-SQL statements with a semicolon.

    And I know there will be shed loads of code which isn't terminated with a ;

    Thanks again for you assitance, appreciate it.

  • The reason it doesn't pick it up as an issue is that currently, that format is still permitted. In SQL 2016, 'string_alias' = expression will be accepted, however, it will not be in a future version of SQL.

    The same is true for not ending with Semi Colons, It is still permitted in SQL 2016. Deprecated means that it is going to be phased out and removed, not that the functionality has been removed already.

    The tool is most likely going to bring back breaking changes,  of which details can be found here: https://msdn.microsoft.com/en-us/library/ms143179.aspx

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thanks for the clarification!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply