Results 1 to 6 of 6

Thread: Can We?

  1. #1
    Join Date
    Mar 2007
    Posts
    2

    Question Can We?

    Can we enter two records together in the INSERT TABLE option using " INSERT INTO TABLE_NAME " command?

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Depens on where the data come from. Possible with 'insert into table select ... from ...'.

  3. #3
    Join Date
    Mar 2007
    Posts
    2
    Quote Originally Posted by rmiao
    Depens on where the data come from. Possible with 'insert into table select ... from ...'.
    NOW DEAR FRIEND,
    my difficulty was in this perticular example i'm noting below,

    insert into TABLE
    (colmn1, colmn2, colmn3,..........) values ('1', '2', '3', ........)

    In simillar way can we post another RECORD in this same command?

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    You need separate insert statement to insert the row in this case.

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    If you can get the rows to insert using SELECT statement then you can insert multiple rows as

    INSERT into TABLE
    (colmn1, colmn2, colmn3,..........)
    SELECT (col1val,....)
    FROM sourcetable


    You can also build SELECT rowset with hard coded values using UNION, but there is no gain compared to individual INSERTs

  6. #6
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    create table abc (id int, name varchar(100))
    insert into abc
    select 1,'A'
    union
    select 2,'B'
    union
    select 3,'c'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •