Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Insert Data From One Table to Another Table in SQL

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 308
    Comment on it

    How to Insert Data From One Table to Another Table in SQL

    step1: Create two tables ContentTable1 Table and ContentTable2 Table

    CREATE TABLE ContentTable1
    (
     ContentId1 int identity(1, 1) not null,
     ContentHeading1 nvarchar(100) NULL,
     ContentText1 nvarchar (Max) Null,
     ContentTag1 nvarchar (100) Null
    )
    
    CREATE TABLE ContentTable2
    (
     ContentId2 int identity(1, 1) not null,
     ContentHeading2 nvarchar(100) NULL,
     ContentText2 nvarchar (Max) Null,
     ContentTag2 nvarchar (100) Null
    )
    

    step2: Insert record into ContentTable1 table

    INSERT INTO ContentTable1 VALUES('Syntax of Create command in sql','How to create table in sql','Syntax of Create command')
    INSERT INTO ContentTable1 VALUES('Syntax of Insert command in sql','How to insert data into table in sql','Syntax of Insert command')
    

    step3: Insert record from ContentTable1 table to ContentTable2 table

    INSERT INTO ContentTable2 (ContentHeading2, ContentText2, ContentTag2) SELECT ContentHeading1, ContentText1, ContentTag1 FROM ContentTable1 WHERE ContentId1 = '2'
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: