如何在MSSQL中将数据从一个表移动并复制到另一个表 [英] How to move and copy data from one table to another table in MSSQL

查看:459
本文介绍了如何在MSSQL中将数据从一个表移动并复制到另一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1.我想将所有数据从旧表移动到新表,如剪切和粘贴。

2.然后想要移动一些数据(当我点击前端特定行的复选框时)从旧表到新表如复制粘贴。



任何正文在asp.net中给出示例c#.i需要代码格式化。(SQL查询)



我尝试过:



如何将数据从一个表移动到另一个表MSSQL中的表

1.I want to move all data from old table to new table like cut and paste.
2.Then want to move some data(when i click check box particular row in front end)from old to new table like copy paste.

Any body give example in asp.net c#.i need code behind format.(SQL queries)

What I have tried:

How to move and copy data from one table to another table in MSSQL

推荐答案

想一想!



逻辑:

Think of it!

Logic:


  1. 移动

  1. Move

    • INSERT[^] (add) data into new or existing table
    • DELETE[^] (remove) data from source table


  • 将数据插入(添加)到新表或现有表中





实现这一目标的最佳方法是使用存储过程 [ ^ ]。



欲了解更多详情,请参阅:

< a href =https://msdn.microsoft.com/en-us/library/bb399407(v=vs.110).aspx>演练:仅使用存储过程(C#) [ ^ ]

使用ADO.NET创建简单的数据应用程序 [ ^ ]



试试!



The best way to achieve that is to use stored procedures[^].

For further details, please see:
Walkthrough: Using Only Stored Procedures (C#)[^]
Create a simple data application by using ADO.NET[^]

Try!


试试这个...

Try this ...
Select * into YourNewTableName from YourOldTableName



它将创建所有数据并将其复制到yourNewTable中。之后你可以在上面插入更多的记录。



谢谢

AARIF SHAIKH


It will create and copy all data into yourNewTable. after that you can insert more records on it.

Thanks
AARIF SHAIKH


这篇关于如何在MSSQL中将数据从一个表移动并复制到另一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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