Search code examples
sql-servermanagement-studio-express

Parse SQL script as 2005 in 2012?


In SQL Server 2012 Management Studio, is there a way to to parse my SQL as SQL Server 2005 syntax? My development PC has SQL Server 2012 Express but the production server uses 2005. I have to hook into a 2005 development server to run my tests before pushing to production.

It would be really nice if I could test for SQL Server 2005 correctness from a 2012 server


Solution

  • use Compatibility Level.

    For 2005, use COMPATIBILITY_LEVEL 90

    ALTER DATABASE database_name   
    SET COMPATIBILITY_LEVEL = 90
    

    refer to here for more information https://msdn.microsoft.com/en-us/library/bb510680.aspx