如何复制SQL Server 2000的表编程方式使用.NET 2.0? [英] How to duplicate a SQL Server 2000 table programatically using .NET 2.0?

查看:153
本文介绍了如何复制SQL Server 2000的表编程方式使用.NET 2.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要备份的表保存副本在同一数据库使用其他名称。我想编程方式使用.NET 2.0(preferably C#)来做到这一点。有人能指出我该怎么办?

I want to backup a table saving the copy in the same database with another name. I want to do it programatically using .NET 2.0 (preferably C#). Someone can point me what should I do?

推荐答案

只需发送此查询到服务器:

Just send this query to the server:

SELECT * INTO [BackupTable] FROM [OriginalTable]

这将从头开始创建备份表(如果它已经存在的错误将被抛出)。对于大表是prepared它需要一段时间。这应该模仿的数据类型,整理和NULL的含量(NULL或NOT NULL),但不会复制索引,键或类似的限制。

This will create the backup table from scratch (an error will be thrown if it already exists). For large tables be prepared for it to take a while. This should mimic datatypes, collation, and NULLness (NULL or NOT NULL), but will not copy indexes, keys, or similar constraints.

如果您需要帮助发送SQL查询到数据库中,这是一个不同的问题。

If you need help sending sql queries to the database, that's a different issue.

这篇关于如何复制SQL Server 2000的表编程方式使用.NET 2.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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