-->
SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Bert Wagner

Bert Wagner is a Business Intelligence Developer at Progressive Insurance. He enjoys solving challenging data transformations with T-SQL and optimizing for query performance. In addition to BI development, Bert loves building ASP.NET MVC web apps and building Internet of Things projects.

Visualizing Nested Loops Joins And Understanding Their Implications

Watch this week’s episode on YouTube.

What Physical Join Operators Tell Us

Everyone has their own method of reading an execution plan when performance tuning a slow SQL query.  One of the first things I like to look at are what kind of join operators are being used:

These three… Read more

1 comments, 77 reads

Posted in Bert Wagner on 11 December 2018

Two Words For Faster Scalar Functions

Watch this week’s episode on YouTube.

WITH SCHEMABINDING optimizations were added all the way back in SQL Server 2005.  So why bother talking about them in 2018?

Because no one is taking advantage of them!

Ok, maybe that’s a little unfair.  I’m sure some people advantage of the optimizations,… Read more

19 comments, 113 reads

Posted in Bert Wagner on 4 December 2018

Brute Forcing SQL Logins and Passwords

Watch this week’s episode on YouTube.

Following up on last week’s post about the different types of SQL injection, this week I want to show how injection can be used to obtain a SQL login and its password.

My goal with today’s post is to show how easy… Read more

0 comments, 194 reads

Posted in Bert Wagner on 27 November 2018

4 SQL Injection Techniques For Stealing Data

Watch this week’s episode on YouTube

I’m not advocating that you start using SQL injection to start stealing other people’s data.

However, I do think that you should familiarize yourself with the various SQL injection techniques so that you will be better prepared to prevent them from happening in your… Read more

4 comments, 2,883 reads

Posted in Bert Wagner on 20 November 2018

Bert & Pinal Troubleshoot a Slow Performing SQL Server

What happens when you run into performance tuning expert Pinal Dave?  Talk about how to troubleshoot a slow performing SQL Server of course!

This week is all about the video, so if you can’t view it above, head on over to my YouTube channel to watch it there. Read more

3 comments, 164 reads

Posted in Bert Wagner on 13 November 2018

Learning New Skills

This post is a response to this month’s T-SQL Tuesday #108 prompt by Malathi Mahadevan.  T-SQL Tuesday is a way for the SQL Server community to share ideas about different database and professional topics every month.

This month’s topic asks to share how we learn skills other than SQL… Read more

0 comments, 2,355 reads

Posted in Bert Wagner on 6 November 2018

The 5 Scariest Moments for a SQL Server Developer

While families and friends are scaring each other this Halloween week with stories of ghosts and ghouls, I thought it’d be way scarier to talk about truncate tables and source control.

Accidental Data Deletion

You’ve spent all morning loading millions of records into your tables.  Some of that data was… Read more

4 comments, 4,657 reads

Posted in Bert Wagner on 30 October 2018

Unexpected Shorthand Date Implicit Conversions

I do my best work in the mornings.  Evenings are pretty good too once I get a second wind.

Late afternoon are my nemesis for getting any serious technical or creative work done.  Usually I reserve that time for responding to emails, writing documentation, and brewing coffee.

Some afternoons I… Read more

4 comments, 2,620 reads

Posted in Bert Wagner on 23 October 2018

Conditionally Returning Rows Based On Query Results

While I normally prefer formatting my query results in a downstream app/reporting layer, sometimes I can’t get around adding some business formatting logic to my SQL queries.

Today I want to show you four different ways to conditionally output rows of data based on a SQL query.

Setting Up The…

Read more

0 comments, 2,358 reads

Posted in Bert Wagner on 16 October 2018

The Project Graveyard

This post is a response to this month’s T-SQL Tuesday #107 prompt by Jeff Mlakar.  T-SQL Tuesday is a way for the SQL Server community to share ideas about different database and professional topics every month.

This month’s Halloween themed topic asks to “…
share a story about a… Read more

2 comments, 2,582 reads

Posted in Bert Wagner on 9 October 2018

Power BI Dashboards, Reports, and Datasets with the SQL Chefs

This week I had the opportunity to learn about dashboards, reports, and datasets in Power BI using the best kind of teaching tool: fresh, delicious, chocolate chip cookies.

Be our guest for the web’s premier Power BI food show as Eugene Meidinger (@SQLGene) explains how these concepts relate… Read more

0 comments, 2,764 reads

Posted in Bert Wagner on 2 October 2018

Shortchanged with International Money in SQL Server

Imagine you have to perform some salary analysis for your employer International Mega Corp.

The data you have to work with looks something like this:

DROP TABLE IF EXISTS ##InternationalMegaCorpSalaries;
GO
CREATE TABLE ##InternationalMegaCorpSalaries
(
	EmployeeId int IDENTITY,
	Salary nvarchar(10),
	Country nvarchar(20),
);
INSERT INTO ##InternationalMegaCorpSalaries VALUES ('1,000.00','United States');
INSERT…

Read more

1 comments, 1,611 reads

Posted in Bert Wagner on 25 September 2018

Extracting JSON Values Longer Than 4000 Characters

A while back I built an automated process that parses JSON strings into a relational format.

Up until recently this process had been working great: my output table had all of the data I was expecting, neatly parsed into the correct rows and columns.

Last week I noticed an error… Read more

6 comments, 174 reads

Posted in Bert Wagner on 18 September 2018

Faking Temporal Tables with Triggers

This post is a response to this month’s T-SQL Tuesday #106 prompt by Steve Jones.  T-SQL Tuesday is a way for the SQL Server community to share ideas about different database and professional topics every month.

This month’s topic asks to share our experiences with triggers in SQL Server. Read more

9 comments, 2,267 reads

Posted in Bert Wagner on 11 September 2018

Does The Order Of Index Columns Matter?

When beginning to learn SQL, at some point you learn that indexes can be created to help improve the performance of queries.

Creating your first few indexes can be intimidating though, particularly when trying to understand what order to put your key columns in.

Today we’ll look at how row… Read more

2 comments, 4,056 reads

Posted in Bert Wagner on 4 September 2018

Ignoring NULLs with FIRST_VALUE

Watch this week’s episode on YouTube.

The SQL Server FIRST_VALUE function makes it easy to return the “first value in an ordered set of values.”

The problem is that if that first value happens to be a NULL, there is no easy, built-in way to skip it.

While a… Read more

6 comments, 1,123 reads

Posted in Bert Wagner on 28 August 2018

FizzBuzz and Multiple Recursive Member CTEs

Watch this week’s episode on YouTube.

Last week I needed to write a recursive common table expression.  I’ve written them before, but it’s been a while and needed to visit the documentation to reference the syntax.

Instead of going straight to the examples, I decided to read into some… Read more

4 comments, 2,137 reads

Posted in Bert Wagner on 21 August 2018

6 Techniques For Troubleshooting Your Code

This post is a response to this month’s T-SQL Tuesday #105 prompt by Wayne Sheffield.  T-SQL Tuesday is a way for the SQL Server community to share ideas about different database and professional topics every month.

This month’s topic asks to share a time you ran into a metaphorical… Read more

5 comments, 3,675 reads

Posted in Bert Wagner on 14 August 2018

Displaying Long Values in SSMS

Click here to watch this week’s video on YouTube.

I write a lot of dynamic SQL and frequently encounter variables that contain many characters:

DECLARE @LongValue NVARCHAR(MAX) = CAST('' AS NVARCHAR(MAX)) + 
N'SELECT
	''A'' AS AShortValue,
	'''+REPLICATE(N'A',4000)+''' as ALongValue
ORDER BY 1';

This variable is 4059 characters long, and… Read more

2 comments, 217 reads

Posted in Bert Wagner on 7 August 2018

Should You Use Index Hints?

Watch this week’s post on YouTube

One of the things that the SQL Server query optimizer does is determine how to retrieve the data requested by your query.

Usually it does a pretty good job, which is a great because if it didn’t then we’d be spending most of our… Read more

3 comments, 2,905 reads

Posted in Bert Wagner on 31 July 2018

Older posts