generate insert statement with data from table

  • Hi all,

    My need is to generate insert statement with data from table (using existing data from that table).

    For example, I got table sometable1 and it has columns id, name.

    The result should look somewhat like this:

    Insert Into sometable1 (id, name) values (1, 'sometext1');
    Insert Into sometable1 (id, name) values (2, 'sometext2');

    How do I achieve this?

    Tbh, I googled it successfully some days ago, now I need it again and can't find. Sigh.

    Please advise.

  • Hi,

    Based on my assumption that you are having access to Microsoft SQL Server Management Studio, you can follow the options:

    step 1: From object browser, right click on your database and choose Tasks > Generate Scripts.

    step 2: From the popup, choose "select specific database objects" from the options and click next,

    step 3: In the next step, choose the tables that you want the insert scripts to be generated for and click next,

    step 4: In the next step, click on "Advanced" button and make sure to set "Types of data to script" to "Data only" and click next.

    This might generate the insert scripts for the table(s) selected.

    Thanks.

  • Thanks debasis.yours

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply