|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 7:59 AM
Points: 24,
Visits: 86
|
|
Hi, I am writing a SSIS package of copying CSV files to SQL tables.
Csv files are five in numbers in each multiple folders in Source Directory having same schema.
Problem is
how do i copy file to sql server table based on MATCHING NAMES of Files(.CSV) and Tables (of SQL).
Thanks,
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:49 PM
Points: 6,703,
Visits: 11,733
|
|
You can set the name of a source file in a Flat File Connection Manager and the table name in an OLE DB Destination dynamically using variables and Expressions. As long as the source csv file and destination tables are all the same schema it will work.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 7:59 AM
Points: 24,
Visits: 86
|
|
Thanks for your replay,,, yes i know the expression property of connection manager. Problem is : i have files like EDGStock.csv , JHBStock.csv etc in Source PAth. i have Stock Table in SQL Server.
how do i tell OLE DB connection manager that it should load only files having KEYWORD "STOCK" in every iteration of FOR LOOP Container.
Thanks
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:49 PM
Points: 6,703,
Visits: 11,733
|
|
You can decide that in the Expression of the Variable that determines which table name your OLE DB Destination points to.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 7:59 AM
Points: 24,
Visits: 86
|
|
| can i use sql command for it?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 1:49 PM
Points: 6,703,
Visits: 11,733
|
|
iamsql1 (2/1/2013) can i use sql command for it? No, Table name or view name variable.
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 7:59 AM
Points: 24,
Visits: 86
|
|
HI i have an idea. can i use a stored procedure and get it executed in EXECUTE SQL TASK instead of using ole db destination for inserting , updating data in sql server db. ????
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 12:08 PM
Points: 4,238,
Visits: 9,480
|
|
iamsql1 (2/4/2013) HI i have an idea. can i use a stored procedure and get it executed in EXECUTE SQL TASK instead of using ole db destination for inserting , updating data in sql server db. ????
Of course - but then the question becomes 'why bother with SSIS at all?'
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 29, 2013 7:59 AM
Points: 24,
Visits: 86
|
|
Hi Phill I am newbie to SSIS, i tried every effort to change the variable in olde db destination , but mapping of columns become issue.
i am stuck on it half a week., can u present specific example in it?
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 12:08 PM
Points: 4,238,
Visits: 9,480
|
|
iamsql1 (2/4/2013) Hi Phill I am newbie to SSIS, i tried every effort to change the variable in olde db destination , but mapping of columns become issue.
i am stuck on it half a week., can u present specific example in it?
OPC.Three made a critically important comment above: As long as the source csv file and destination tables are all the same schema it will work.
My version of this is: "If column definitions in either the source or the destination are different, for any of the files, it will not work"
It seems that you have fallen foul of this.
You will need a separate data flow for every different source file format you have. And for every destination table whose columns are different (by name or by type).
It's difficult to be more specific without understanding the source and target schemas better.
But the important lesson to take away is the SSIS is largely driven by meta data which is generated at design time. Dynamic column mapping / naming / typing is not an easy option.
____________________________________________________________________________________________
Help us to help you. For better, quicker and more focused answers to your questions, consider following the advice in this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
|
|
|
|