Create Insert data script for views

  • Dear All

    For one table I need to create insert statemetn with data. For this I used SSMS-Task -Generate script - Data only it creates inserts will all the rows.

    But i need only few selected rows.Hence created a view and tried the same thing but it does not generate insert script with data.

    I am doing somthing wrong?

    Regards

  • I have acheved it using a new table instead of view

    Is there any better way?

  • Krishna1 (3/4/2013)


    Dear All

    For one table I need to create insert statemetn with data. For this I used SSMS-Task -Generate script - Data only it creates inserts will all the rows.

    But i need only few selected rows.Hence created a view and tried the same thing but it does not generate insert script with data.

    I am doing somthing wrong?

    Regards

    INSERT INTO newtable (columnlist) SELECT columnlist FROM oldtable WHERE...

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Thanks. That what i have done,

    Select coumn list fom table into newtable where ....

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

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