如何创建一个新的数据库,如现有的数据库 [英] How to Create an new database like existing database

查看:66
本文介绍了如何创建一个新的数据库,如现有的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sql server中有一个数据库.它有一些表.当我在项目中创建新公司时,我想创建新数据库(例如现有数据库)并使用不同的名称,然后访问该数据库以指定公司.所以我创建新数据库,就像现有数据库一样.请任何人在运行时提供帮助.

I have an database in sql server. It has some tables. I want create new database like existing database with different name, When I create new company in my project.And I access that database for specify company. So I create new database like existing database. Please anybody help how to do it, at runtime.

推荐答案

您需要:
1)备份数据库
2)将备份还原到新的数据库名称.
3)Truncate Table [insert table name]用于所有表.
You need to :
1) Backup the database
2) Restore the backup to a new database name.
3) Truncate Table [insert table name] for all your tables.




这是您的解决方案:

http://weblogs.asp.net/mschwarz/archive/2004/08/26/220735.aspx [ ^ ]
Hi,

Here is your solution :

http://weblogs.asp.net/mschwarz/archive/2004/08/26/220735.aspx[^]



您可以Generate script到旧数据库,然后在新数据库上执行脚本
检查此链接
Hi ,
You can Generate script to old DB and then Execute the Script on the new DB
Check this link Here[^]
Best Regards
M.Mitwalli


这篇关于如何创建一个新的数据库,如现有的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆