Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:23:59+00:00 2026-06-05T03:23:59+00:00

I have a table and it has 500 rows. I want to retrieve only

  • 0

I have a table and it has 500 rows. I want to retrieve only 10 rows and i want to insert into another table using control flow only. Through data flow task we can use OLEDB source and OLEDB destination. But i want result in such a way that by using execute sql task and for each loop. Is it possible to do in that way? My Idea is, get the set of ten records and and by using foreach loop iterate to every row and insert into the table by using execute sql task. The destination table need to create on the fly. I tried with some approach but not moving towards. Please find the image file.enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:24:01+00:00Added an answer on June 5, 2026 at 3:24 am

    Example taken from Northwind

    Create variables (in variable collection) which represent the columns in the table which u ll create at runtime
    Example :-

           Customer_ID as string
           Order_Id as int   
    

    Then u need to create Execute SQL Task and write the below query to select first 10 rows

       Select top 10* from orders
    

    Use FullResultSet and in Result Set configuration store the table rows in a variableName :- User::Result ResultName:0

    Drop one Execute SQL Task and create a table on fly

     IF OBJECT_ID('myOrders') IS not NULL
     drop table myOrders
    
     Create table myOrders
     (OrderID  int,
      CustomerID varchar(50)
     )
    

    combine the 2 flows from Execute sql task and connect it to the Foreach loop

    Drag a foreach loop .In collection use enumerator type as Foreach ADO Enumerator
    In enumerator configuration select user::Result variable which stores the top 10 rows from the execute sql task and select the radio button ” Rows in the first table”
    In variable mapping ,map the column variables which u have created in the first step and the index will 0 for first column and 1 for 2nd column
    enter image description here

    Drag a execute sql task inside a foreach loop and write the below query :

      Insert into myOrders( OrderID,CustomerID)
      values
      (?,?)
    

    Map the parameters using parameter mapping configuration in execute sql task

      VariableName : OrderID  Direction : Input   DataType=Long ParamterName=0
      VariableName : CustomerID  Direction : Input   DataType=varchar ParamterName=1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a table in our database which has around 2,500,000 rows (around 3GB).
Table has 1 500 000 records, 1 250 000 of them have field =
I am using MySQL. I have a table called entries. This table has a
I have a table with just 400-500 rows but this table is being accessed
We have a loop in our PHP code which inserts rows into a table.
Background : I have a database table filled with over 500 rows . The
I have a table that has about 400,000+ rows. I am writing some pattern
i have a table has php variables fetched from mysql , the table is
i have a table called as X and this table has a field known
Lets say I have one table called REVIEWS This table has Reviews that customers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.