开发者

Easy way to copy rows between identical table schemas [Visual Studio 2010]

开发者 https://www.devze.com 2023-02-05 06:15 出处:网络
How do I transfer some rows from one table to another in the easiest possible manner? This is 开发者_JAVA技巧a one time thing. I was hoping I could use VS2010 copy and paste function in Server Explore

How do I transfer some rows from one table to another in the easiest possible manner? This is 开发者_JAVA技巧a one time thing. I was hoping I could use VS2010 copy and paste function in Server Explorer, but it doesn't allow me to paste in rows.


As the table schema is the same then you can use copy and paste using Sql Server Management Studio rather than VS2010

You could also use a T-SQL statement using SSMS

Insert Into dbo.TableB (ColumnA, ColumnB, ColumnC ...)
Select ColumnA, ColumnB, ColumnC ...  
From dbo.TableA 


select * into <destination table> from <source table>

Example:
select * into employee_backup from employee

You can add WHERE clauses and specify columns as needed.

As per http://cavemansblog.wordpress.com/2009/06/09/sql-server-how-to-copy-a-table/

0

精彩评论

暂无评论...
验证码 换一张
取 消