Insert statement issue

  • Is there a way to do an insert statement and an import into a database in the same data flow task?

    What I have is a .csv file with an id, emp_social, emp_no.

    I want to add the client name and id to these columns, which would be id, emp_social, emp_no, client_id, and client_name.

    I need to insert the client_id and client_name to all of these records upon the insert.

    Is there a way to do this? Possibly a select * type of insert?

  • but where are u getting this id and client name from ...plz explain it clearly so that there would be a better to chance to get the answer...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • The client name is just the name of the company it is coming from and the client id is an abbreviation based on that.

    For example:

    client_name: Jay High School

    client_id: JHS

    This data is manually inserted on each data flow task that needs it.

  • So do u have a table with column names --id, emp_social, emp_no.,cline_id,client_name in the destination

    i want to know if u want to match based on name and insert it or insert jsv to all rows ...let me know accord to whchi we can move fwd

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • you can use `Execute SQL Task` on control Flow Task and then use data flow task for further process.

    hope this helps 😉

    thanks

    Nilesh

  • The table (destination) is _id (IDENTITY), emp_ssno, emp_no, client_id, client_name.

    The only information coming from the .csv file is emp_ssno and emp_no. _id is an IDENTITY that is generated upon insert. Client_id and Client_name are always NULL, which is where I want to insert the client information.

    For now I have done a SQL Task, located after the Data Flow Task, that inserts the client information when the columns are NULL.

    UPDATE emp

    SET client_id = 'id',

    client_name = 'name'

    WHERE client_id IS NULL

    That is the current code I am using to do this task at the moment. I just know there has to be a better way to do it.

  • Is the Client name and id same for all the data if so why dont u set default in ur dest table ......

    if not where do u get it from ....

    anyway i believe u can use derived columns task to add new columns or add column value to a column in ssis ...

    u vl have expressions in derived columns which u can try i belive .....

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • The client_id and client_name are the same for each file (each file has a different client) I import into the database. The database itself is much bigger and has multiple clients.

    I will try your suggestion. Thanks for the reply.

Viewing 8 posts - 1 through 7 (of 7 total)

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