Insert rows from one table to another in MS-SQL

Sometimes it is handy to be able to copy data from one table to another.  This is easy by using SELECT INTO:

SELECT * INTO dbo.MyTable1 FROM dbo.MyTable WHERE F1 > 100

This will take all rows from MyTable that have F1 higher than 100 and create a new table with this data called Mytable1.  This can be great when testing databases and programs that manipulate data as you have a copy of the original data and can compare it.

Arnor Baldvinsson
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk