Insert data from one table to another table


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’

Advertisements

2 thoughts on “Insert data from one table to another table

  1. Kamesh shah

    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

    Reply
  2. Elite Case Bambus

    Nice blog here! Also your web site rather a lot up fast!
    What web host are you the use of? Can I am getting
    your affiliate hyperlink for your host? I want my website
    loaded up as fast as yours lol

    Reply

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 )

Google+ photo

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

Connecting to %s