Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
SSIS Practice Tasks

SSIS Practice Tasks

Ratings: (0)|Views: 109|Likes:
Published by shra1one

More info:

Published by: shra1one on Apr 27, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

11/14/2012

pdf

text

original

 
SSISTasks:Module1:TheAdventureWorksInc.Salesdepartmentwouldlikeforyoutoproduceanextractforthemtoimportintoaproprietarysystem.They’dliketheextracttotaketheProduct_Transaction_History.csvandProduct_Transaction_History_Archive.csvfiles(foundinsidetheD:\SSISTasks\Module1Filesfolder)andpullouttheproductsbyquantityandgroupedbyProductID.Theextractlayoutshouldcontainthefollowingfields:ProductID–UniqueproductidentifierQuantityOrdered–TotalofthisproductthathasbeenorderedLastTransactionDate–ThedateofthelastpurchaseofthisproductTotalCost–Thetotalcostofthisproduct(Hint:Quantity*ActualCost)ExpectedResultTheextractshouldbeacommaseparatedvaluefile(CSV)andthenameofthefileshouldhavethecurrentdateappendedtoit.TheextractshouldalsobeorderedbyProductIDinascendingorderandTotalCostinascendingorder.Module2:TheAdventureWorksInc.Marketingdepartmenthaspurchasedasubscriptiontoazipcodedatabasefortheirdirectmailers.TheywishtoimportthisdataonamonthlybasisintotheirSQLServerautomaticallyandcompletelyrefreshthetable.Inthispractice,youaregoingtotakeaflatfileextractthatcontainseveryzipcodeintheUnitedStatesandloaditintotheAdventureWorksdatabase.You’regoingtoensurethatthetablewillbedroppedandreloadedeverytimethepackageisrun.Wewillusethistableinlaterpracticesasalookuptable,sopleasedonotskipthispractice!ModuleRequirementsa. CreateanewSSISprojectandapackagecalledModule2LabA.dtsxb. Createapackagethataccomplishesthefollowinggoals:i. PackageexecutestheD:\SSISTasks\Module2Files\Module2LabA-1.sqlSQLscript.Note:Appendthetablenameinthescriptfilewithyournamei.e.<yourname>ZipCodeLookupii. PackagebulkloadstheD:\SSISTasks\Module2Files\ZipCodeExtract.csvfileintothenewlycreatedAdventureWorks.dbo.<yourname>ZipCodeLookuptable.ExpectedResultModule3:TheAdventureWorksInc.MarketingdepartmentwouldliketosendcatalogstonewlyformedcorporationsinthestateofFlorida.TheyonlycareaboutthecompaniesthatareownedbyFloridabasedresidents.TheirITdepartmenthaspurchasedaseriesofextractsfromthestateandmarketingwouldlikethedatacleansedbeforeitisloaded.Thedataiskeyedinbyuserswhodonotnecessarilyhavetofollowdataintegritystandards.Forexample,afieldliketheCityfieldisanoptionalfield.Inthispractice,youwilluseafewofthekeytransformationsinSSIStocleanseandstandardizethedata.Rowsthatdon’tmatchthecompaniesthatmarketingcareaboutwillbewrittentoaqueueformanualinspection.ModuleRequirementsa. CreateanewSSISprojectandapackagecalledModule3LabA.dtsxb. Createapackagethataccomplishesthefollowinggoals:i. ReadstheD:\SSISTasks\Module3Files\010305c.datcommadelimitedfileThefileiscommadelimitedwithatextqualifierofadouble-quote(“).Thefirstrowinthefileisaheaderthatcontainsthecolumnnames.ii. Writethedatainthefiletoanewtable(createbyclickingtheNewTablebuttoninthedestinations)called<yourname>MarketingMailing.iii. Ensurethezipcodeisonly5digitsalwaysbeforewritingtothetable.iv. Cityandstateisarequiredfieldforthemailingcampaign.Iftherowdoesnotcontainacityorastate,lookitupagainstthe<yourname>ZipCodeLookup(usingthezipcode)tablethatyoucreatedinModule2.Ifyoustillcan’tfindit,movethatonerecordtoa<yourname>MailingErrorQueue
 
tabletobemanuallyinspectedbytheQAteam.c. TheAddressLine1andAddressLine2columnsshouldbesettoastringthatis150charactersinlength(intheConnectionManager).ExpectedResultinDataflowtask(NamethisasLoadMarketingLeads.)Module4:TheAdventureWorksInc.MarketingdepartmentwouldliketoensurethatthesamefileisneverloadedtwiceintoitsMarketingMailingtable.Todothis,youproposethatafteryouloadafile,youarchivethefileintoadirectoryanddynamicallyrenamethefile.Inthispractice,youwilluseexpressionsandvariablestostarttomakethepackagedynamicandtoarchivethefileyouwillusetheFileSystemtask.Modulerequirementsa. ClonetheModule3LabA.dtsxpackageintoanotherpackagescalledModule4LabA.dtsxbycopyingandpasting.b. Modifythepackagesothataccomplishesthefollowinggoals:i. Createasetofstringvariables:strFileName–holdsthefullpathandfilename.
setthevaluetoD:\SSISTasks\Module4Files\010305c.datstrArchiveFileName–holdsthefullpathandfilenameofthearchivefile.
SetvaluetoblankstrSourceFolder–holdsthepathtowherethefilesoriginatefrom
setthevaluetoD:\SSISTasks\Module4Files\(it’simportantthatyoukeepthesamecasesensitivecharactersyouseeinthesevalues)strArchiveFolder–holdsthepathtowherethefilewillbearchivedto
setthevaluetoD:\SSISTasks\Module4Files\Archive(it’simportantthatyoukeepthesamecasesensitivecharactersyouseeinthesevalues)strDBName–holdsthedatabaseyou’reloading
setthevaluetoAdventureWorksstrServerName–holdstheservernameyou’reloading
setthevalueto<Servername>oryourcomputername.setthevalueforstrArchiveFileNamefrompropertieswindow
Setthevalueto“@[User::strArchiveFolder]+"\\Processed_"+RIGHT(@[User::strFileName],11)”thiswillbeadynamicvalue.ii. SetuptheflatfileconnectionmanagertoreaditsfilenamefromthestrFileNamevariableiii. ArchivethefiletothearchivepathinthestrArchiveFoldervariableandrenamethefiletoProcessed_FileName.datlikeProcessed_010305c.dat.iv. SetuptheOLEDBconnectionmanagertousethenecessaryvariablestomaketheconnectiondynamic.ExpectedResultinControlflowtaskNote:Toconfirmthepackageworkedend-to-end,openFileExplorerandbrowsetotheD:\SSISTasks\Module4Files\Archivedirectory.YoushouldseeonefileinthedirectorycalledProcessed_010305c.dat.IntheD:\SSISTasks\Module4Files\directory,the010305.datfileshouldnowbegone.Ifyouweretoexecutethepackageagain,thefirststepwouldfailsincethefileisnolongerinthedirectory.YoucanhoweverchangethevariabletoanewfilenameintheVariableswindowandre-execute.Module5:YouareaDBAfortheAdventureWorksInc.andhavegrownwearyofconstantlymanuallyreconfiguringthepackagetoloadthecorporationdataforyourMarketingdepartment.You’dliketomodifythepackagetoreadadirectoryandloadeveryfilethatendswitha.DATextensionandthenarchivethefileautomatically.Inthispractice,youwillusetheForEachLoopcontainertocreatealoopintheco

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->