Insert data from one table to another table

Posted by Jugal Shah on January 6, 2011


You can insert the data from one table to another table using SELECT INTO and INSERT INTO with SELECT.. FROM clause.


– Below statement will create the temp table to insert records
select * INTO #tmpObjects from sys.sysobjects where type = ‘u’

– Below statement will create the user table to insert records.
– First will create the table and insert it details as well in new table
select * INTO tmpObjects from sys.sysobjects where type = ‘u’

–Below statement will insert new data into table
insert into tmpObjects SELECT * from sys.sysobjects where type = ‘s’

One Response to “Insert data from one table to another table”

  1. Kamesh shah said

    hi jugalbhai how are you??

    i have subscribed your blog post its good and giving me nice ways to finish ma jobs
    nice job keep it up………………
    that yesterdays blog ‘GO ‘(we can modify batch separator) was very nice i tried…

    Kamesh

Thanks for the comment, will get back to you soon... Jugal Shah

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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

 
Follow

Get every new post delivered to your Inbox.

Join 175 other followers