开发者

How do I back up SQL 2008 tables & stored procedures?

开发者 https://www.devze.com 2022-12-22 03:12 出处:网络
Last night I got completely hosed by a worm from Dilbert.com (so be careful there). It is invasive enough where I am going to do a complete system restore. The only thing I need to save on the pc is a

Last night I got completely hosed by a worm from Dilbert.com (so be careful there). It is invasive enough where I am going to do a complete system restore. The only thing I need to save on the pc is a database (consisting of just tables & stored procs) in SQL 2008. How 开发者_开发技巧can I export them so that, once I restore, I can easily import them again. I thought about doing Access, but that is never completely clean (data types get changed and such).


You should just be able to back up the database from within SQL Server Management Studio. Right-click on the database in the Object Explorer and use the context menu to begin a backup operation.


In addition to the backup operation, which restores everything, you can also use the Generate Scripts option in SQL Server Management Studio to create a text dump of all the tables, keys, stored procedures, users, and so on. This option is available by selecting your database (left click once), right click to get the option menu, then choose "Tasks" (which opens a new submenu) and then "Generate Scripts...". Note that the Generate Scripts wizard is NOT the came as the "Script Database As" option. The "Script Database As" option is very limited, and won't give you many of the database entities you need for a complete restore of the schema.


Alternatively since you are going to take the machine down anyway, just detach the database. Then you can copy the file to an external hard drive or another machine.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号