### Define Keys in Biml
Source: https://docs.varigence.com/biml-reference/snippets/tables-keys
Example showing the implementation of Identity, UniqueKey, and PrimaryKey within a Biml Table definition.
```xml
```
--------------------------------
### Unpivot Transformation Biml Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-unpivot
Demonstrates the configuration of an Unpivot transformation following a Pivot transformation to restore original data structure.
```Biml
select * from SurveyResponses order by surveyid, attribute, response
```
--------------------------------
### Execute Multiple Packages with Precedence Constraints
Source: https://docs.varigence.com/biml-reference/snippets/ssis-tasks-execute-package
This example demonstrates how to define a series of ExecutePackage tasks that run in a specific order using PrecedenceConstraints.
```xml
```
--------------------------------
### Multicast Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-multicast
Demonstrates how to use the Multicast transformation to split an OLE DB source into two separate flat file destinations.
```xml
select * from DimInstrument
```
--------------------------------
### Union All Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-union-all
Combines data from two OleDbSource components into a single FlatFileDestination.
```xml
select * from SurveyResponsesselect * from JuniorSurveyResponses
```
--------------------------------
### Import Column Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-import-column
Demonstrates the use of an ImportColumn transformation to map a 'FileName' column from a Script Component source to a Flat File destination.
```xml
```
--------------------------------
### Row Sampling Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-row-sampling
Demonstrates the use of the RowSampling element within a Dataflow to extract a random sample of 25 rows.
```xml
select * from DimInstrument
```
--------------------------------
### Sort Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-sort
Demonstrates sorting rows by a specific column and eliminating duplicates within a Biml dataflow.
```xml
select * from DimInstrument
```
--------------------------------
### Percentage Sampling Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-percentage-sampling
Configures a PercentageSampling transformation to output 20% of rows randomly from an OLE DB source to a flat file destination.
```Biml
select * from DimInstrument
```
--------------------------------
### Copy Column Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-copy-column
Demonstrates the Copy Column transformation within a Biml package to duplicate the 'Category' column into 'SubCategory'.
```xml
select * from DimInstrument
```
--------------------------------
### Implement Row Count Transformation
Source: https://docs.varigence.com/biml-reference/snippets/transformations-row-count
This example demonstrates how to count rows from an OLE DB source and store the result in a package variable named User.RowCount.
```xml
select * from SurveyResponses0
```
--------------------------------
### Merge Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-merge
Demonstrates merging two OLE DB sources into a single output using the Merge transformation. Ensure both input sources are sorted by the specified columns.
```Biml
select * from SurveyResponses order by surveyid, attribute, responseselect * from JuniorSurveyResponses order by surveyid, attribute, response
```
--------------------------------
### Define a ScriptTaskProject in Biml
Source: https://docs.varigence.com/biml-reference/snippets/script-projects-script-task-project
This example demonstrates the XML structure for a ScriptTaskProject, including assembly references, file content for AssemblyInfo.cs and ScriptMain.cs, and variable declarations.
```xml
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle("ST_19338c2d3c5d43d1b77d01b996ae1485.csproj")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Varigence")]
[assembly: AssemblyProduct("ST_19338c2d3c5d43d1b77d01b996ae1485.csproj")]
[assembly: AssemblyCopyright("Copyright @ Varigence 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.0.*")]
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
public void Main()
{
if (Dts.Variables["User::TestVariable"].ReadOnly)
{
Dts.Events.FireError(0, "Simple Task Script Project", "Variable is readonly", string.Empty, 0);
}
Dts.TaskResult = (int)ScriptResults.Success;
}
}
```
--------------------------------
### Define a Cube Perspective in Biml
Source: https://docs.varigence.com/biml-reference/snippets/cubes-perspective
This example shows the structure for a cube perspective, including its associated actions, calculations, KPIs, measure groups, and dimensions.
```xml
[Measures].[Internet Sales Amount] - [Measures].[Internet Total Product Cost]
```
--------------------------------
### Aggregate Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-aggregate
Demonstrates the use of an Aggregate transformation to calculate a distinct count of the DisplayName column from an OLE DB source.
```xml
select * from DimFrequency
```
--------------------------------
### Data Conversion Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-data-conversion
Demonstrates how to use the DataConversion element to change the data type of a specific source column to StringFixedLength.
```xml
select * from DimInstrument
```
--------------------------------
### Merge Join Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-merge-join
Configures a Merge Join transformation with an Inner Join type, specifying left and right input paths and join keys.
```Biml
select * from SurveyResponses order by response, attribute, surveyidselect * from SportDescription order by sport
```
--------------------------------
### Conditional Split Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-conditional-split
Demonstrates routing rows from an OLE DB source to a specific output path when the first three characters of the 'Category' column match 'PRE'.
```xml
select * from DimInstrumentSUBSTRING(Category, 1, 3) == "PRE"
```
--------------------------------
### Configure WMI Event Watcher for Disk Space Monitoring
Source: https://docs.varigence.com/biml-reference/snippets/ssis-tasks-wmi-event-watcher
This example demonstrates using a WMI Event Watcher task to trigger when the free space on the C: drive drops below a specified threshold defined in an SSIS variable.
```xml
"SELECT * FROM __InstanceModificationEvent WITHIN 5 WHERE TargetInstance ISA \"Win32_LogicalDisk\" AND TargetInstance.Name=\"C:\" AND TargetInstance.FreeSpace < " + (DT_WSTR, 50)@[User::FreeSpaceThreshold]104857600
```
--------------------------------
### Fuzzy Grouping Transformation in Biml
Source: https://docs.varigence.com/biml-reference/snippets/transformations-fuzzy-grouping
This example demonstrates how to configure a Fuzzy Grouping transformation within a Biml Dataflow task to group similar values in a 'Response' column.
```xml
select * from SurveyResponses
```
--------------------------------
### Export Column Biml Configuration
Source: https://docs.varigence.com/biml-reference/snippets/transformations-export-column
Example of how to configure the ExportColumn transformation within a Biml Dataflow task to export data to a file.
```APIDOC
## ExportColumn Transformation
### Description
The ExportColumn transformation is used to export the contents of a specific column to a file path defined by another column in the data stream.
### Configuration
- **Name**: The name of the transformation.
- **Columns**:
- **FilePathColumn**: The name of the column containing the destination file path.
- **ExtractColumn**: The name of the column containing the data to be exported.
- **AllowAppend**: Boolean indicating if the data should be appended to the file if it already exists.
- **InputPath**: The OutputPathName from the preceding transformation.
### Example
```xml
```
```
--------------------------------
### Biml Foreach File Loop Implementation
Source: https://docs.varigence.com/biml-reference/snippets/ssis-tasks-foreach-file-loop
Configures a Foreach File Loop to iterate through files in a specified directory and perform a File System move operation.
```Biml
```
--------------------------------
### Term Extraction Transformation Example
Source: https://docs.varigence.com/biml-reference/snippets/transformations-term-extraction
Configures a Term Extraction transformation to identify terms occurring at least three times in the 'Response' column.
```Biml
select * from SurveyResponses
```
--------------------------------
### Generate Extraction Packages for All Tables
Source: https://docs.varigence.com/biml-reference/snippets/bimlscripts-extract-all-tables
Uses a C# template to iterate over RootNode.Tables, creating a data flow package for each table and a master driver package to execute them.
```Biml
<#@ template language="C#" hostspecific="true"#>
<#@ import namespace="System.Data" #>
<# foreach (var table in RootNode.Tables) { #>
SELECT * FROM <#=table.Name#>
<# } #>
<# foreach (var table in RootNode.Tables) { #>
<# } #>
```
--------------------------------
### Clone a Table in Biml
Source: https://docs.varigence.com/biml-reference/snippets/tables-clone-table
Demonstrates how to use the CloneTable element to create a new table named SampleTableClone based on SampleTable, while adding an extra column.
```xml
```
--------------------------------
### Define a Calculated Member in Biml
Source: https://docs.varigence.com/biml-reference/snippets/cubes-calculated-member
This example shows the structure for a CalculatedMember element within an MdxScript, including the MDX expression and associated non-empty behaviors.
```xml
[Measures].[Internet Sales Amount] - [Measures].[Internet Total Product Cost]
```
--------------------------------
### Generate Dataflow Tasks for Table Copying
Source: https://docs.varigence.com/biml-reference/snippets/ssis-tasks-dataflow
Uses a C# loop within Biml to iterate through tables and create individual Dataflow tasks for each table that does not start with 'v'.
```biml
<#
foreach (var table in OrderTablesByDependency())
{
if (!table.Name.StartsWith("v"))
{
#>
SELECT * FROM <#=table.Name#>
<# }
} #>
```
--------------------------------
### Define a SQL Server Management Connection
Source: https://docs.varigence.com/biml-reference/snippets/connections-sql-server-management
Use this Biml snippet to define a connection to a SQL Server instance named localhost.
```xml
```