Daniel O
Daniel O

Reputation: 4634

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

How do I transfer some rows from one table to another in the easiest possible manner? This is 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.

Upvotes: 1

Views: 2410

Answers (2)

Brendan Hannemann
Brendan Hannemann

Reputation: 2154

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/

Upvotes: 0

codingbadger
codingbadger

Reputation: 44032

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 

Upvotes: 3

Related Questions