how to load data for each employee

Answered how to load data for each employee

  • Friday, March 23, 2012 3:53 PM
     
     

    i hav 100 records in emp table

    how to load data for each employee

All Replies

  • Friday, March 23, 2012 4:22 PM
     
     

    how to load data for each employee


    please give an example?  Load as in emailing them a file about them??????

    Sincerely SH -- MCITP 2008, MCTS 2008 & 2005 -- Please kindly mark the post(s) that answered your question and/or vote for the post(s).

  • Friday, March 23, 2012 4:29 PM
    Moderator
     
     

    i hav 100 records in emp table

    how to load data for each employee

    You need to provide much MUCH more information if you want a helpful answer to this.

    ObjectStorageHelper<T> – A WinRT utility for Windows 8 | http://sqlblog.com/blogs/jamie_thomson/ | @jamiet | About me
    Jamie Thomson

  • Tuesday, March 27, 2012 9:00 AM
    Moderator
     
     Answered

    Hi vijay60,

    Do you mean is that loading data to a flat file or other destination according to the Employee? Please feel free to let me know if my understanding is wrong.

    In that case, I suggest you can use ForEach Loop Container loops over the Employee and then load accordingly data to the destination, for more details about how to do it, please refer to Todd's reply in the following similar thread: http://social.msdn.microsoft.com/Forums/en/sqlintegrationservices/thread/39b49bb4-e60a-42b5-989c-fcf49b8eb6f4 

    Just like others say, please supply more information about your question, and then we could help you better.

    Thanks,
    Eileen

  • Tuesday, March 27, 2012 10:09 AM
     
     

    Hello,

    Please elaborate more on your requirements it will help us to solve your issue.

  • Tuesday, March 27, 2012 12:36 PM
     
     Proposed
     

    Assuming your requirement,

    You have a table called "Employee" which is having 100 records like

    EmpID

    EmpDetails1

    EmpDetails2

    EmpDetails3

    1

     

     

     

    2

     

     

     

    3

     

     

     

    4

     

     

     

    5

     

     

     

    6

     

     

     

    7

     

     

     

    8

     

     

     

    9

     

     

     

    10

     

     

     

    11

     

     

     

    12

     

     

     

    13

     

     

     

    And i can assume that you requirement is to update the "Employee" table against each empid.

    This can be easily achieved by cursor:

    SET

    NOCOUNT ON;

    Declare

    @var1 nvarchar(50)

    Declare

    @Temp1 table (t1_empid int)

    Insert

    into @Temp1(t1_empid)

    Select

    [EmpId] from Employee

    Declare Cursor_Employee Cursor For

    Select [t1_empid] from @Temp1

    Open Cursor_Employee

    Fetch Next From Cursor_Employee

    Into @var1

    while @@Fetch_Status = 0

    Begin

     

    Update Employee

    set EmpDetails1 = "Rahul"

    where EmpId = @var1

    Update Employee

    set EmpDetails2 = "Vairagi"

    where EmpId = @var1

    Update Employee

    set EmpDetails3 = "Bangalore"

    where EmpId = @var1

    End

    FETCH NEXT FROM Cursor_Employee

    INTO @var1;

    CLOSE

    Cursor_Employee;

    DEALLOCATE

    Cursor_Employee