SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2004
    Location
    penang
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inserting multiple row through sql

    Hi all,

    How do you insert multiple row in 1 sql statment?

    Thank you

  2. #2
    SitePoint Addict sinapra's Avatar
    Join Date
    Sep 2004
    Location
    secunderabad
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    putting where condition : example

    update tablename set name = 'whatever' where sal = '5000'

    all the names would be updated whose sal is = 5000

    similieeeeee
    Regards

    Its Great to work and Be Merry!!!!!!!!

  3. #3
    SitePoint Member AngelaR's Avatar
    Join Date
    Jul 2004
    Location
    Brighton, UK
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or if you are inserting new records then you may need a loop around the SQL insert code so it keeps inserting rows until the conditions set have been met.

  4. #4
    SitePoint Member
    Join Date
    Sep 2004
    Location
    penang
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey all,

    after few dig in and out from the web, this is what i found out,

    to insert multiple row with 1 sql statement, say 3 rows

    insert into tablename (field1)
    select 'value1' from dual
    union all
    select 'value2' from dual
    union all
    select 'value3' from dual


Bookmarks

Posting Permissions

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