Upgrade SQL Server database - sql-server

I used to have SQL Server 2008, I have upgraded to SQL Server 2012. However, when I go to attach a database, in this case AdventureWorks 2012, it won't let me attach it and says that it can't attach a 706 version because it only supports 661 and earlier.
I assume the server is still 2008, even though the application says 2012. I have run the SELECT ##VERSION, and it confirms that it is a 2008 database, I just don't know how to upgrade this server to 2012. I want to be able to open/attach new databases.
Any help would be great.

Related

Determine SQL Server instance being used by TFS 2015

I have a server that has TFS 2015. Originally, it was running against SQL Server 2012. I backed up the databases and then upgraded to SQL Server 2016. After upgrading to SQL Server 2016 TFS seems to work fine but I still see several entries in programs and features for SQL Server 2012.
My question: How do I check TFS 2015 to verify that it is indeed now running against SQL Server 2016?
If not, I'm guessing that if both SQL Server 2012 and 2016 are installed I have the ability to make TFS switch from one to the other?

Does my sql code go unavailable when I upgrade my SQL Server from 2008 to 2014?

I have a server running SQL Server 2008 Enterprise version which has a lot of SQL Codes and I want to upgrade it into SQL Server 2014 Enterprise version. But I don't know what will happen after I upgrade the SQL Server. Will there any SQL Code go unavailable/error? Will it run correctly after upgrading?
SQL Server 2008/2014 is a tool. It has got nothing to do with data/procedures/views etc. Data for SQL Server is stored in the form of .mdf files. So, no, your data or procedurers wont be touched. But yes lot of features are going to be deprecated in SQL Server 2014 when compared to SQL Server 2008. Full list is here. You should go through the list and find a suitable replacement for every deprecated item before migrating.

Are there glitches with trying to use SQL Server Management Studio 2008 R2 to manage MSSQL 2005 DB instances?

I'm currently using Microsoft SQL Server Management Studio ver. 9.00.4035.00 to manage my SQL Server 2005 (90) compatible databases.
Will I encounter problems should I attempt to upgrade the Management Studio software to SQL Server Management Studio 2008 R2 to manage MSSQL 2005 DB instances? I will not be upgrading the version of the database instance.
My personal expreience says that you wont have any migration issues if you have sql server 2005 db instances. The attach and detach of DB is same in 2008 version. Only thing is, once you use a 2005 instance DB and attach it to 2008 version, it cannot be used with 2005 version again. Apart from that, from functionality point of view, there are no issues, you can continue to use the 2005 version DB on 2008 as normal.
link for moving the DB from 2005 to 2008 -
http://www.packtpub.com/article/moving-a-database-from-sql-server-2005-to-sql-server-2008-in-three-steps
EDIT: Incase you want to move back to 2005 version for same DB instance, I dont think it will be possible except for doing a data export import onto new 2005 DB instance.

SQL Server version 612 , 655?

I have SQL Server 2008 and VS2008 installed on my computer and I am trying to run a web application I've created on a computer which has SQL Server 2008 and VS2008 and VS2010 beta 2 with its SQL Server Express.
I am getting an error with the database version that is
"...aspnetdb.mdf" cannot be opened because it is version 655. This server supports version 612 and earlier...."
Configuring the database in Visual Studio ->Tools -> Options -> Design-Time Validation Database is not working since I don't have the SQL Server version comes with VS 2010.
EDITED : I also edited aspnetdb and inserted a few more tables so I need the same aspnetdb
Is there any solution to convert this db ?
Also, after fixing this, I am looking forward to upload it on my hosting which has SQL Server 2005 DB and configure it in PLESK.
The SQL Server databases have a version specific format. Each SQL Server runtime version (SQL 2008 SP1, SQL 2008 RTM, SQL 2005 SP2, SQL 2005 SP1, SQL 2005 RTM etc) knows how to upgrade to its own verison. Unfortunately, once upgraded the database cannot be downgraded. So if your MDF was upgraded to version 655, it cannot be downgraded to any prior version. If you know you're going to deploy on SQL Server 2005, you must develop on SQL Server 2005 too. Not only that, but the actual build number of your development has to match the build number of the deployment (or at least be lower than that): the SP level and CU level must match.
You can a attach the 2008 version MDF you created to a SQL Server 2008, script out the database content, then import the script into a SQL Server 2005 database of the proper version.
I had this problem and when I changed my_computer_name\SQLEXPRESS with . to connect to server and it works and I could attach MDF file
may be you have both services run. (Mssql2008 and mssqlexpress) Maybe you have runing the mssqlespress running, that's the error that you have. Try to stop the mssqlserver express service and run mssql2008 services, and attach again your databases. I try this and works for me

SMO and Sql Server 7.0

Does anyone have a definitive answer to whether Sql Server Management Objects is compatible with Sql Server 7.0?
The docs state:
Because SMO is compatible with SQL Server version 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008, you easily manage a multi-version environment.
But trying to connect to a Sql 7 instance gets me:
"This SQL Server version (7.0) is not supported."
Has anyone been successful in getting these 2 to play nice?
you can use SMO to connect to SQL Server versions 7, 2000, and 2005, but SMO does not support databases set to compatibility levels 60, 65, and 70.
for SQL Server 7.0 the compatibility level is 70
Obviously this is conflicting information...I assume if your compatibility level of your DB is 70 you can not connect.
To check run: EXEC sp_dbcmptlevel 'databasename'
Looking through this link, it seems you might be able to change the compatibility level by running this:
EXEC sp_dbcmptlevel 'databasename', 80
Obviously make a back up before changing anything.
Looks like the docs are wrong (and have continued to be wrong for the last 3+ years!). I found this snippet with Reflector in Microsoft.SqlServer.Management.Common.ConnectionManager, Microsoft.SqlServer.ConnectionInfo
protected void CheckServerVersion(ServerVersion version) {
if ((version.Major <= 7 || (version.Major > 9)) {
throw new ConnectionFailureException(
StringConnectionInfo.ConnectToInvalidVersion(version.ToString())
);
}
}
So, it looks like only SQL 2000 and SQL 2005 are supported. Presumably, SQL 2008 (version 10) has updated SMO assemblies.
Bummer - guess it's back to SQL-DMO for this project.
Just to follow up on your commment SQL 2008 does have its own SMO package which supports SQL 2000, 2005 and 2008 which is actually definitively documented on their download page! And you're right you can't connect SQL 2005 SMO to SQL 2008.
There are some nice updates updates in Version 10 of the SMO in that if you access properties that do not existing on the version of SQL that you are connect to you get a sensible "This property is not available on this Version of SQL" exception or words to that effect.
Microsoft SQL Server 2008 Management Objects
The SQL Server Management Objects (SMO) is a .NET Framework object model that enables software developers to create client-side applications to manage and administer SQL Server objects and services. This object model will work with SQL Server 2000, SQL Server 2005 and SQL Server 2008.
Sorry for the late answer... there is partial support for SQL 2000 and SQL 7

Resources