Jason yousef ssis expressions - no notes
-
Upload
jasonyousef -
Category
Documents
-
view
457 -
download
0
Transcript of Jason yousef ssis expressions - no notes
![Page 1: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/1.jpg)
LET’S TALK DYNAMIC….SSIS EXPRESSIONS AND VARIABLES
Jason Yousef, MS MCITP MCTS
![Page 2: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/2.jpg)
Why would you listen to me!• Sr. Database Engineer.• SQL BI & SQL Developer Trainer.• Started with SQL Server 7.
![Page 3: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/3.jpg)
Agenda Overview (Variables / Expressions). Variables – Data Types, scope, Namespace and naming conventions. Variables – Debugging using Breakpoints. Variables – User & System Variables using ‘Package Configurations’. Variables – Using .NET in a Script Task. (Control Flow) Variables – Using .NET in a Script Component. (Data Flow) Expressions and Dynamic SSIS. Expressions - Operators, Functions, Literals and Casting. Using the Expressions builder and the Expression Tester Application. Common String, Numeric, NULL, Conditional and Date & Time
examples. Q & A.
![Page 4: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/4.jpg)
Overview Variables:
A place holder for your values, used to store and pass values between tasks and containers internally or between packages (child and parent packages).
Expressions: An expression is a combination of multiple
operators and functions and could reference multiple columns or variables to yield a single data value.
![Page 5: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/5.jpg)
Variables
Right click (Designer) VariablesSSIS (Menu) VariablesView (Menu) OTHER WINDOWS Variables
![Page 6: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/6.jpg)
Variables – Date Types
Data types are .Net data typesSSIS supports the following data types:
http://tinyurl.com/ssisDT
Boolean Byte Char
DateTime DBNull Double / Decimal
Int16 Int32 Object
SByte String UInt32
UInt64 Int64 Single
![Page 7: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/7.jpg)
Variables – Scope , NameSpace
A way to organize your package and limit your variables to a certain task using Scopes or NameSpaces.
As variables’ names are unique, you can have the same name across multiple ‘Scopes’ or ‘Name spaces’
![Page 8: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/8.jpg)
Variables – Naming Conventions
Name: Name of your variable. Preferable and suggested to use a meaningful Camel Case name, including its data type abbreviation, such as:
StrFName: For a string data type variable. IntTotalSales: For an integer data type variable, you
can also specify if it’s Int16, Int32 or Int64. (too much!) DTSalesDate: For a Date Time variable. BoolFileFound: For a Boolean variable, holds a flag (0
or1).
![Page 9: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/9.jpg)
Variables – Breakpoints Debugging values.
![Page 10: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/10.jpg)
Variables – Package Configurations
Read & write to system and User variables using ‘Package Configurations’
![Page 11: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/11.jpg)
Variables – Reading / Writing Using .Net
Script Task (Control Flow)
![Page 12: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/12.jpg)
Variables – Reading / Writing Using .Net
Script Component (Data Flow Task)
![Page 13: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/13.jpg)
Variables using .NET
Demo
![Page 14: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/14.jpg)
Expressions - Overview used to assign values to variables, update or populate
properties at run time, define constraints in precedence constraints, and provide the expressions used by the For Loop container.
The language is somehow similar to the curly braces languages (C++,C# or Java ).
Almost any task in SSIS, if not all, can use expressions to make its properties dynamic.
“Execute SQL Task” dynamic SQL query. “Derived Column” validate or assign value to a column. “Conditional Split” to split a column based on a specific condition. “Precedence Constraints“ direct the flow to a different route based on
a custom condition within the Control Flow.
![Page 15: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/15.jpg)
Expression Builder SSIS 2005, 2008
![Page 16: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/16.jpg)
SSIS 2012 Expression Task
![Page 17: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/17.jpg)
Expression Editor & Tester Tool
http://expressioneditor.codeplex.com/
![Page 18: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/18.jpg)
Expressions - Literals
Hard coded info that you provide when building expressions (Numeric, String and Boolean) to give more info about the expression’s value.
Numeric
Numeric literals checked for decimal points before getting casted to DT_UI4, and to DT_NUMERIC if there’s a decimal. To override use one of these suffixes.
![Page 19: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/19.jpg)
Expressions - Literals
Boolean (True OR False) String
Escape Description
\n New Line
\b Backspace
\” Creates a Double Quotes
\t Tab
\\ Creates a backslash, used for URLs
![Page 20: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/20.jpg)
Expressions - Operators
+ Add or (Concatenate)
- Subtracts or (Negates )
* Multiply / Divide
|| Logical OR && Logical AND
== Equal != Un Equal
? : Conditional < Less Than
> Greater Than <= Less Than or Equal
>= Greater Than or Equal
& Bitwise AND
![Page 21: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/21.jpg)
Expressions - Casting Converts an expression from one data
type to a different data type. Implicit - Automatically Explicit – Using CAST
DT_BOOL True / False
DT_DBDATE Date
DT_DBTIMESTAMP
Date & Time
DT_I4 Four-byte, signed integer.
DT_DECIMALDT_NUMERIC
Decimal with precision and scale
DT_WSTR Unicode character string
![Page 22: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/22.jpg)
Demo
Most commonly used expressions
![Page 23: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/23.jpg)
Demo
SSIS 2012 New Expressions
![Page 24: Jason yousef ssis expressions - no notes](https://reader036.fdocuments.in/reader036/viewer/2022062406/558fd02a1a28ab341b8b465a/html5/thumbnails/24.jpg)
Questions & Contact Info Email: [email protected] Blog: www.jasonyousef.com Twitter: @Huslayer
Speaker Rating : http://spkr8.com/t/18591
Thanks for coming!