0

I have make a backup file from a database in SQL Server 2012. But I can't restore it in a new database in SQL Server 2008r2 with the .bak file.

It always returns a warning that cast is not valid(sqlmanager.ui).

Is there any way to restore it?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
shuvo sarker
  • 881
  • 11
  • 20
  • Possible duplicate of [Create SQL Server 2012 database compatible for 2008](http://stackoverflow.com/questions/17450114/create-sql-server-2012-database-compatible-for-2008) – Tanner Feb 17 '16 at 15:31

1 Answers1

1

You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility.

You can either get around this problem by

  • using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances

  • otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool

  • or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459