I have to run the backup of SQL Server 2000 in SQL Server 2008.
我必须在SQL Server 2008中运行SQL Server 2000的备份。
While restoring the database from the .bak
file, I got the error
从.bak文件恢复数据库时,我收到了错误
specified cast is invalid
指定演员表无效
After doing google I feel there is compatibility issue. Therefore I want to make the database compatibile to SQL Server 2000.
做谷歌后我觉得有兼容性问题。因此,我想使数据库兼容SQL Server 2000。
And run the below query
并运行以下查询
ALTER DATABASE DBNAME
SET COMPATIBILITY_LEVEL = 80
but nothing help. Any help will be appreciated.
但没有任何帮助。任何帮助将不胜感激。
2 个解决方案
#1
1
You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server (like 2008) down to an older version (like 2000) - the internal file structures are just too different to support backwards compatibility.
您不能这样做 - 您无法将数据库从较新版本的SQL Server(如2008)附加/分离或备份/恢复到较旧版本(如2000) - 内部文件结构太不同,无法支持向后兼容性。
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
在所有计算机上使用相同版本的SQL Server - 然后您可以轻松地在实例之间备份/还原数据库
-
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否则,您可以在SQL Server Management Studio(任务>生成脚本)或使用第三方为结构(表,视图,存储过程等)和内容(表中包含的实际数据)创建数据库脚本工具
-
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.
或者您可以使用Red-Gate的SQL Compare和SQL Data Compare等第三方工具在源和目标之间进行“区分”,根据这些差异生成更新脚本,然后在目标平台上执行这些脚本;这适用于不同的SQL Server版本。
#2
0
Changing the compatibility level will get you closer to SQL 2000 but there were breaking changes (more likely they came in when 2005 did), unfortunately you will need to find where you get things that break and manually fix them.
更改兼容性级别将使您更接近SQL 2000,但有一些重大变化(更有可能是它们在2005年出现时),不幸的是,您需要找到中断的地方并手动修复它们。
Ed
#1
1
You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server (like 2008) down to an older version (like 2000) - the internal file structures are just too different to support backwards compatibility.
您不能这样做 - 您无法将数据库从较新版本的SQL Server(如2008)附加/分离或备份/恢复到较旧版本(如2000) - 内部文件结构太不同,无法支持向后兼容性。
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
在所有计算机上使用相同版本的SQL Server - 然后您可以轻松地在实例之间备份/还原数据库
-
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否则,您可以在SQL Server Management Studio(任务>生成脚本)或使用第三方为结构(表,视图,存储过程等)和内容(表中包含的实际数据)创建数据库脚本工具
-
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.
或者您可以使用Red-Gate的SQL Compare和SQL Data Compare等第三方工具在源和目标之间进行“区分”,根据这些差异生成更新脚本,然后在目标平台上执行这些脚本;这适用于不同的SQL Server版本。
#2
0
Changing the compatibility level will get you closer to SQL 2000 but there were breaking changes (more likely they came in when 2005 did), unfortunately you will need to find where you get things that break and manually fix them.
更改兼容性级别将使您更接近SQL 2000,但有一些重大变化(更有可能是它们在2005年出现时),不幸的是,您需要找到中断的地方并手动修复它们。
Ed