Press "Enter" to skip to content

Curated SQL Posts

Writing C# Extension Methods In Biml

Cathrine Wilhelmsen shows us how to avoid repeating our C# code using extensions:

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.

*pushes up glasses* You know, this would be even easier in F# and wouldn’t need extension methods.

Joking-not-joking aside, read the whole thing.

Comments closed

Catalog Your SQL Servers: The SQL Undercover Catalogue

David Fowler announces the SQL Undercover Catalogue:

Where Can I Get the Catalogue From?

The Undercover Catalogue is available from our GitHub site.

What Does the Catalogue Store?

The Undercover Catalogue stores all manner of useful information on your SQL Servers,

  • Instances –
  • Databases
  • Logins
  • Users and permissions
  • Agent Jobs

with many more modules planned in future releases.

Check it out and I’m sure they’d love feedback.  Also, read on for where this toolkit is going.

Comments closed

The Gartner Hype Cycle, AI Edition

Alex Woodie reviews the latest Gartner Hype Cycle for Emerging Tech:

Democratized artificial intelligence is one of five trends driving Gartner’s latest Hype Cycle for Emerging Technologies, which it updates this month, as it traditionally does during the month of August.

The analyst group took a slightly different approach with this year’s Hype Cycle for Emerging Tech and grouped the 35 individual technologies into major groups, which includes digitalized ecosystems, do-it-yourself biohacking, transparently immersive experiences, and ubiquitous infrastructure, along with democratized AI.

The five trends will “blur the lines between human and machine,” Gartner says. “CIOs and technology leaders should always be scanning the market along with assessing and piloting emerging technologies to identify new business opportunities with high impact potential and strategic relevance for their business,” writes Mike J. Walker, research vice president at Gartner.

It’s an interesting exercise and parlor game.

Comments closed

Power BI Helper 4.0 Released

Reza Rad has introduced a new version of Power BI Helper:

Power BI Helper is getting new features every time, and this time, we got some exciting features; You can now get your M (Power Query script) code beautified and colorful with version 4.0 of Power BI Helper. We also get the row-level security information exposed through the Helper application. Both information above will be now available when you export the model information to a document. If you like to learn more about Power BI Helper, read this page.

Looks good.

Comments closed

GOTO And Labels In T-SQL

Ryan Desmond demonstrates the purpose of GOTO in T-SQL:

So I was playing around at work today and decided for whatever reason to see how I could get the code I was writing to fire off only in certain situations.

If it’s Sunday maybe, or if this is in a particular environment, or if a record in an admin table was something specific.  I’m not sure how I’ll use this but I stumbled on Labels and decided to play with them.

Ok, so how to get to know labels.  Well, in order to get them to work sometimes I have to create labels that are based on some criteria.

I do try to avoid these as much as possible, but they are valid syntax and I’ve seen a couple of cases where it makes sense to use GOTO.

1 Comment

Saving Newlines When Copying From SSMS Grids

Kenneth Fisher shows us how to retain CR/LF values when copying and pasting from SQL Server Management Studio grids:

Now, you do need to be aware that the settings Tools -> Options are just for new query windows. If you want to change the settings for an already existing window then either go to Query -> Query Options or right click in the window and go to Query Options from there.

Either way, once you are done and re-run your script you get this when you copy and paste:

Click through for the tip.

Comments closed

T-SQL Tuesday Roundup

Wayne Sheffield is back with a T-SQL Tuesday roundup for August:

I asked for the topic to be on:

Tell me about a time when you ran up against your own brick wall, and how you worked it out or dealt with it.

We had 17 folks take this topic and run with it. As a teaser, my favorite line in all of these is:

My feeling is that if you’re not hitting brick walls you’re probably not pushing yourself or SQL Server hard enough!

With 17 responses, there’s a good bit of reading to do.

Comments closed

More On Radix Sorting In R

Inaki Ucar explains some of the nuance behind sorting in R:

The latest R tip in Win-Vector Blog encourages you to Use Radix Sort based on a simple benchmark showing a x35 speedup compared to the default method, but with no further explanation. In my opinion, though, the complete tip would be, instead, use radix sort… if you know what you are doing, because a quick benchmark shouldn’t spare you the effort of actually reading the docs. And here is a spoiler: you are already using it.

One may wonder why R’s default sorting algorithm is so bad, and why was even chosen. The thing is that there is a trick here, and to understand it, first we must understand the benchmark’s data and then read the docs.

Read the whole thing.

Comments closed

Your R Code Should Be In Source Control Too

Lindsay Carr explains the importance of storing your R code in source control:

But wait, I would need to learn an additional tool?

Yes, but don’t panic! Git is a tool with various commands that you can use to help track your changes. Luckily, you don’t need to know too many commands in Git to use the basic functionality. As an added bonus, using Git with RStudio takes away some of the burden of knowing Git commands by including buttons for common actions.

As with any tool that you pick up to help your scientific workflows, there is some upfront work before you can start seeing the benefits. Don’t let that deter you. Git can be very easy once you get the gist. Think about the benefits of being able to track changes: you can make some changes, have a record of that change and who made it, and you can tie that change to a specific problem that was reported or feature request that was noted.

It’s still code, and you gain a lot by keeping code in source control.

Comments closed

The Power Of Resilient Distributed Datasets

Ramandeep Kaur explains just how powerful Resilient Distributed Datasets are:

A fault-tolerant collection of elements that can be operated on in parallel:  “Resilient Distributed Dataset” a.k.a. RDD

RDD (Resilient Distributed Dataset) is the fundamental data structure of Apache Spark which are an immutable collection of objects which computes on the different node of the cluster. Each and every dataset in Spark RDD is logically partitioned across many servers so that they can be computed on different nodes of the cluster.

RDDs provide a restricted form of shared memory, based on coarse-grained transformations rather than fine-grained updates to shared state.

Coarse-grained transformations are those that are applied over an entire dataset. On the other hand, a fine grained transaction is one applied on smaller set, may be a single row. But with fine grained transactions you have to save the updates which can be costlier but it is flexible than a coarse grained one.

Read on for more about the fundamental data structure in Spark.

Comments closed