http://msdn.microsoft.com/en-us/library/ms141036%28v=sql.105%29.aspx -- Data Typeshttp://msdn.microsoft.com/en-us/library/ms141260%28v=sql.105%29.aspx ---Implicit Data Type Conversion in Expressionshttp://msdn.microsoft.com/en-us/library/system.typecode.aspx --.Net data typeshttp://www.sqlservergeeks.com/blogs/RakeshMishra/sql-server-bi/247/data-types-%E2%80%93-sql-server-and-ssishttp://www.bidn.com/blogs/DevinKnight/ssis/1387/ssis-to-sql-server-data-type-translations
Jason yousef ssis expressions - no notes
LET‟S TALK DYNAMIC….SSIS EXPRESSIONS ANDVARIABLESJason Yousef, MS MCITP MCTS
Why would you listen to me!• Sr. Database Engineer.• SQL BI & SQL Developer Trainer.• Started with SQL Server 7.
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.
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: Anexpression is a combination of multiple operators and functions and could reference multiple columns or variables to yield a single
VariablesRight click (Designer) VariablesSSIS (Menu) VariablesView (Menu) OTHER WINDOWS Variables
Variables – Date TypesData types are .Net data typesSSIS supports the following data types: Boolean Byte Char DateTime DBNull Double / Decimal Int16 Int32 Object SByte String UInt32 UInt64 Int64 Single http://tinyurl.com/ssisDT
Variables – Scope , NameSpaceA way to organize your package and limityour variables to a certain task usingScopes or NameSpaces.As variables’ names are unique, you canhave the same name across multiple‘Scopes’ or ‘Name spaces’
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
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.
Expressions - LiteralsHard coded info that you provide when building expressions (Numeric, String andBoolean) to give more info about the expression‟s value. NumericNumeric literals checked for decimal points before gettingcasted to DT_UI4, and to DT_NUMERIC if there‟s adecimal. To override use one of these suffixes.
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
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
Expressions - Casting Converts an expression from one data type to a different data type. DT_BOOL True / False Implicit - Automatically DT_DBDATE Date Explicit – Using CAST DT_DBTIMESTA Date & Time MP DT_I4 Four-byte, signed integer. DT_DECIMAL Decimal with precision DT_NUMERIC and scale DT_WSTR Unicode character