且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用现有数据库创建新数据库(使用除2表之外的数据复制所有表)。

更新时间:2023-02-03 16:54:02

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



如果您仍想根据现有数据库创建数据库,请阅读此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.