Create Table Using Selected Result

Posted: May 13, 2012 in SQL Server
Tags: , , , , , ,

Last week i got a simple work to create a table with the result of different tables. We can also create a view to see a single result set from different table but my task was to create a table.

I begin with a simple select statement which will show me the desired result. Now after this we will convert the select statement in select into statement.

Select Into

Select Into statements are used to create tables with the same schema and the data which is returned from the select statement.

Syntax of select into

Select * into tablename from oldtablename

Examples Of select into

Select * into new_test from old_test

Select into in joins

Select,b.newid into new_test from oldtablename a <a class="zem_slink" title="Join (SQL)" href="" rel="wikipedia" target="_blank">inner join</a> tbl b on

Try it in your development and i will be back with some more.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s