我想用旧版本上的新存储过程恢复新版本的数据库,如何在旧版本的数据库中保留表的旧数据?
谢谢
Simple: you CANNOT.
SQL Server is NOT backwards compatible - you CANNOT with any method, trick, hack, workaround get a newer database (as .mdf/.ldf
to attach or a a .bak
to restore) onto an older version of SQL Server.
It just cannot be done - period.
You will need to script out your database changes to .sql
files to update the structure on your old server, and you'll need to use SQL or a third-party tool (like Red-Gate SQL Data Compare) to copy over the data, too.
Re-reading your question, I'm not quite sure whether you're talking about "going back" in terms of SQL Server versions (not quite clear, really) - if you just need to bring the changes from a newer database to an older version of the database on the same version of SQL Server - then I'd highly recommend tools like Red-Gate SQL Compare (and the above mentioned Data Compare) for the job.
Those allow you to find structural and data difference between two databases and create update scripts that you can run on the "old" database to bring it up to the same structure as the "new" database.