Parse SQL script as 2005 in 2012? - sql-server

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

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

Related

Snapshot for different SQL Server Version

Can I create a snapshot from SQL Server 2012 on a SQL Server 2008 R2 Server?
The goal is to build reporting and queries without locking the live database.
I need only a DB copy (Getdate()-1)
No, the SQL Server 2012 snapshot has specific SQL Server 2012 features in it that are not compatible with SQL Server 2008 R2. These are incompatibilities that you will not see. They are deep in the SQL Server engine. You cannot do this.
It's a similar concept to trying to restore a SQL Server 2012 database backup to a SQL Server 2008 R2 instance. The higher database version cannot backstep to a lower version.
You need to use a SQL Server of the same level or higher (I believe or higher) for your snapshot server.

Migrate SQL Server 2008 databases to 2016

We are processing to migrate SQL Server databases from 2008 to 2016.
We are searching now for expired function or utilities used in SQL Server 2008 and not available in SQL Server 2016 before migration.
Do you have reference for that?
Here are few features removed in SQL Server 2016 (from MSDN):
SQL Server 2016 is a 64-bit application. 32-bit installation is discontinued, though some elements run as 32-bit components
Compatibility level 90 is discontinued. For more information, see ALTER DATABASE Compatibility Level (Transact-SQL).
Though you are migrating from SQL Server 2008 directly to SQL Server 2016, you need to consider the removed features of SQL Server 2012 & SQL Server 2014 as well
Discontinued Database Engine Functionality in SQL Server 2014
Discontinued Database Engine Functionality in SQL Server 2012

Debugging SQL Server 2005 database with SQL Server 2008 R2 Debugger

I am using SQL Server 2008 R2 Management Studio for an old database that is SQL Server 2005 based. I want to debug my T-SQL code but SQL Server is telling me:
the transact-sql debugger does not support SQL Server 2005 or earlier
versions of SQL Server
What can I do for debugging that T-SQL code?
Yes you are right Management Studio 2008 doesn't support SQL Server 2005 T-SQL code debug.
But you can use Visual Studio. I hope, this article will help to you http://www.dotnetfunda.com/articles/show/27/debugging-stored-procedures-in-sql-server-2005

Migrate SQL Server database 2012 to 2014

I have database that runs on SQL Server 2012. Now I need to move this database to new PC and run it on SQL Server 2014.
What is the best way to do it? I far as I understood it is not possible to backup in 2012 and restore to SQL Server 2014.
Yes, you can restore a SQL Server 2012 backup into a SQL Server 2014 instance. See here.
Please note, you cannot go the other way - you cannot restore a SQL Server 2014 backup into a SQL Server 2012 instance. See here.

Compatilibity level between 2008 and 2012

I have this error using MSMS 2008 trying to connect to SQL 2012. The problem is that the database under SQL 2012 has compatibility level: SQL Server 2008 (100)
https://support.powerdnn.com/kb/a1781/you-receive-errors-when-connecting-to-mssql-2012-using.aspx
My question is: when you restore a SQL 2008 db in SQL 2012, even if the database has compatibility level 2008, the db is converted to 2012 and we can't put it back again in a 2008 server again?
Yes, the database format is not backwards compatible as far as I know
What you can do is use the "generate scripts" functionality to script the entire database out in SQL2008 format and run that on a 2008 server to get a working 2008 version.
Depending on the size of the DB this may be impractical though

Resources