Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | SSIS Integration Services (28 exercises) |
Topic ==> | Script components (2 exercises) |
Level ==> | Relatively easy |
Subject ==> | SSIS training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Create a new package called Calculate durations, and within this create a data flow task which reads in rows from the above workbook. Include a script component at the end:
Initially your script component will have a red cross against it, because you haven't said what it should do.
The imported data contains two columns for each series, giving the premiere date and the finale date:
The series is still going on today, but this exercise author stopped watching it after Rahul did his stuff way back in 2019.
Get your script component to calculate and output a new column giving the duration of each series in days, using code similar to the following:
// take the time difference, and convert it into days
Row.DurationDays = (Row.Finale - Row.Premiere).Days;
Note that you'll need to pass in the Premiere and Finale input columns to the script component, but also add DurationDays as an integer output column.
Add a Union All transform and a data viewer to get this:
When you run the package, it should show your existing columns plus the one you've added in your scrpt component.
Run your package - you should see something like this:
You can click at the top of the DurationDays column to sort the list of series to show the shortest one first.
Take a few moments to think how much easier (and better!) it would have been to use a derived column transform to solve this problem instead, then close down your package.
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.