SolvedPrivate

SQL Server 2008 - SSIS transform

Posted on 2014-10-29
3
20 Views
Last Modified: 2016-02-11
I am creating a sql ssis package.  

The basics of the package is it takes data from a view in Oracle...and puts it in a table in SQL Server.

To get the package started I just used the wizard and made an ssis package that way...then copied that into a more advanced template I have.

However...this is my issue.   Lets say I have a column called account number.   In Oracle it comes over as a varchar(11)...when in fact in sql server I am going to want that to be a varchar(7).  There must be some type of inherent padding in Oracle....

Should I handle this trimming of the fields in the process of it moving from Oracle to sql...

or should I take the table once its in sQL server..and transform it a second time to sql server?

Any suggestions?


Thanks
0
Comment
Question by:Robb Hill
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 40410574
>There must be some type of inherent padding in Oracle....
Explain this.  Left padded spaces, right padded spaces, both?

>Should I handle this trimming of the fields in the process of it moving from Oracle to sql...
Answer could go both ways, so I'd write it in whatever you feel more comfortable with.
   If you can create a view in Oracle that does this and serve as the source, fine.
   SSIS derived column task is fine too.
   Although....

>>or should I take the table once its in sQL server..and transform it a second time to sql server?
I have a preference for doing it this way.  Inserting ALL rows into SQL Server varchar columns, which insures that no matter what blows up, insures that at least the data made it to the target SQL database.  Doing this way implies writing to a staging or temporary table, which I usually prefix with ssis_ or timp_.  

Then you can write a T-SQL SP to do your data scrubbing:  Whatever logic handles the varchar(11) to varchar(7) 'padding', dates are dates, numbers are numbers, you get the idea.  Then import the good rows to the final destination table, and gracefully handle any bad rows.
0
 
LVL 11

Author Closing Comment

by:Robb Hill
ID: 40410582
I have no control over the view being exposed in Oracle....and dont really know how to do this in the middle between the source and destination OLD DB connections.

I will just scrub my staging table and make a new table with all the trimmings..


Thanks for your input!
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40410595
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question