liveBook · Manning

Derived column transformation

As explained in 100 SQL Server Mistakes and How to Avoid Them

A derived column transformation creates or replaces output columns by evaluating expressions for each input row.

A derived column transformation evaluates SSIS expressions for each input row, creating new output columns or replacing existing ones before data reaches its destination. section 6.3.2

Configure the transformation by:

  • Selecting a replacement column or entering a new derived-column name. section 6.3.2
  • Building expressions from columns, variables, parameters, functions, operators, and literals. section 6.3.2
  • Checking automatically inferred data type, length, precision, scale, and code page; red expressions indicate parse errors. section 6.3.2

Marketing impressions data flow

A staging source uses derived columns to convert GUIDs by adding curly braces and casting to DT_GUID, normalize EventTime before casting to DB_TIMESTAMP, convert ReferralURL to DT_TEXT, and turn the string "NULL" StateID into a database null. section 6.3.2

Listing 6.6 SSIS expressions
(DT_GUID)("{" + (DT_WSTR,36)(ImpressionUID) + "}")          #1
(DT_GUID)("{" + (DT_WSTR,36)(CookieID) + "}")               #2
(DT_DBTIMESTAMP)(REPLACE((DT_WSTR,26)EventTime,"/","-"))    #3
(DT_TEXT,1252)ReferralURL                                   #4
(DT_UI1)((DT_WSTR,50)StateID == "NULL" ? NULL(DT_WSTR,50) : #5
(DT_WSTR,50)StateID)                                        #5

Use the SSIS expression listing to inspect the concrete casts, replacement of slash characters, text conversion, and conditional null handling. section 6.3.2

How 100 SQL Server Mistakes and How to Avoid Them covers it

How deep it goes
Explains editor configuration, inferred metadata, parse errors, and concrete type-conversion expressions.
Examples
Demonstrates GUID, timestamp, text, and conditional-null conversions for marketing-impression rows.
What you can do after
Operate/configure SSIS expressions that produce correctly typed output columns and diagnose expression parse errors.
How it connects
Connects data flows, staging tables, destination components, SSIS expressions, casts, and output data types.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 SQL Server Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.