如何使用现有数据库创建新数据库(使用除2表之外的数据复制所有表)。 [英] How to Create new database (copy all table with data excluding 2 table )with existing database.

查看:87
本文介绍了如何使用现有数据库创建新数据库(使用除2表之外的数据复制所有表)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请遵循以下设置:

使用C#

1)当前数据库文件名为DB20122013。
当用户点击新年按钮时


2)创建当前数据库的备份副本

3)新数据库应该创建所有表(不包括表Dailytemp和DailyMain),数据和数据库名称为DB20132014。

解决方案

首先,我不知道为什么要创建另一个数据库实例。不是足够的空间 [ ^ ]将所有数据存储在一起?在我看来,这是不好的做法。



如果您仍想根据现有数据库创建数据库,请阅读此artcile: SQL Server管理对象(SMO)编程指南 [ ^ ]及所有相关文章。


SQL Server中的备份存储过程 [ ^ ]

SQL DB备份 [ ^ ]



执行此程序按照应用

Please follow the scenario:
using C#
1) current database file name is DB20122013.
when user click on new year button
2)Create backup copy of current database
3)New database should create with all table(excluding table "Dailytemp" and "DailyMain") with data and database name as DB20132014.

解决方案

First of all, i have no idea why to create another instance of database. Isn't enough space[^] to store all data together? In my opinion, it is bad practice.

If you still want to create database based on existing one, please, read this artcile: SQL Server Management Objects (SMO) Programming Guide[^] and all related articles.


Backup Stored Procedures in SQL Server[^]
SQL DB Backup[^]

Execute this procedure as per the scenario of the application.


这篇关于如何使用现有数据库创建新数据库(使用除2表之外的数据复制所有表)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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