Skip to content

Tag: Biml

Biml Tips and Tricks (SQLBits 2019 Session Recording)

At SQLBits 2019, I presented my Biml Tips and Tricks: Not Just for SSIS Packages! session. The session recording has been available for many months, but I only just now realized I never blogged abut it 😊 You can view the slide deck on my SlideShare and download my Biml Demos if you want to dig into my code examples.

Biml Tips and Tricks: Not Just for SSIS Packages! Session Recording

Watch the full video on the SQLBits website:

Biml Tips and Tricks Session Recording (SQLBits 2019).

You can increase or decrease the speed, enable closed captioning, and even download the video for offline viewing.

(If you want a laugh, I recommend watching in 2x speed with the not-quite-accurate captions. You’ll see gems like “This is Bemmel. Tips and tricks not just for exercise packages!” 🤣)

Generating SELECT statements in Biml using GetColumnList

Biml Wheel.

In a previous blog post, we looked at how to generate SQL using Biml. (If you haven’t read that post, you may want to start there and then come back here.) In this post, we will go through how to generate SELECT statements using the Biml column method GetColumnList.

Using Biml column methods

Biml column methods return code fragments. These code fragments can be used as building blocks to generate custom T-SQL statements. For example, the GetColumnList method returns a list of columns, separated by commas, that you can use in a SELECT statement. You can filter the columns and customize the output by passing parameters.

Examples of GetColumnList code fragments

If you have a table with three columns, the default output will look something like this:

[PersonID], [FirstName], [LastName]

But what if you don’t want to select all three columns? Or what if you want to use an alias for your table? No problem! The customized output can look something like this instead:

p.FirstName, p.LastName

We will go through the different ways of customizing the output a little later in this post.

Generating SQL using Biml (T-SQL Tuesday #110)

T-SQL Tuesday logo.

The first T-SQL Tuesday of 2019 is hosted by Garry Bargsley (@gbargsley), and the topic is “Automate All the Things”. Garry wants to know what this phrase means to each of us. What do we want to automate? What is our go-to technology for automation? To me, this was super easy. Surprise, surprise! It’s Biml, of course 🤓 Since this post is part of T-SQL Tuesday, I wanted to go back to the basics and write about how you can generate SQL using Biml. But first, a little bit of background for those who are not that familiar with Biml.

Don't Repeat Your Biml - C# Extension Methods

Biml Wheel.

In a previous blog post, we looked at how to use C#/VB Code Files in Biml. There are several benefits to moving custom C# code into separate files. It allows you to reuse that code across multiple projects and solutions. You can maintain the code in your editor of choice, taking advantage of intellisense and syntax highlighting. And finally, my personal favorite: you can create custom extension methods.

In this post, we will look at how to simplify our Biml projects by creating and using C# extension methods. We will build on the examples from the previous C#/VB Code Files in Biml blog post.

Biml for OData Source and Connection Manager in SSIS

Biml Wheel.

As of July 2018, there is no built-in Biml support for OData. To work with OData in Biml, you have to create a custom source and connection manager. This requires more Biml code than built-in functions like OleDbSource and may look a little overwhelming at first. But don’t worry! You don’t have to start from scratch.

In this blog post, we will first look at the properties of the OData Connection Manager and how to script it in Biml. Then, we will do the same for the OData Source. Finally, we will tie it all together and create a complete SSIS package that you can use a starting point for your own projects.