SQL batch inserts into table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Soniad
    New Member
    • Jan 2009
    • 66

    SQL batch inserts into table

    I want multiple records to be inserted in table at one time. How do i do this?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Use INSERT ....SELECT...

    Instead of INSERT....VALUE S...

    Happy Coding!!!

    ~~ CK

    Comment

    • Soniad
      New Member
      • Jan 2009
      • 66

      #3
      Batch Insert

      Hi,

      Thank you. i'll try this in my code.


      Regards ,

      "D"

      Comment

      • Soniad
        New Member
        • Jan 2009
        • 66

        #4
        Hi,

        If it was already a table from which i had to take values, then it could be easier. but the problem is,I post some id's comma seperated to one page there i want these id's to insert into table.since these id's are comma seperated i split it and thyen insert one by one using for loop.
        So,I don't want to do it in for loop. is there any way to insert these comma seperated id's at one time



        Regards ,

        "D"

        Comment

        • ck9663
          Recognized Expert Specialist
          • Jun 2007
          • 2878

          #5
          Here's a pseudo-code...

          1. Create a stored proc that receives an XML variable.
          2. This XML variable can have a predefined or generic column names.
          3. Read this XML as a resultset (table-looking result)
          4. Insert the result of that resultset into your target table.
          5. On your front-end, create a formatted-XML-looking string.
          6. Pass that string to the newly created stored proc.

          Happy Coding!!!

          ~~ CK

          Comment

          • Soniad
            New Member
            • Jan 2009
            • 66

            #6
            Hi,

            Thank you so much.

            Regards,

            "D"

            Comment

            Working...