Tipstricks

A SQL script to automatically infer the data types of data that someone just dumped in your DB with no effort

Do you know the feeling when someone gives you a flat file to import, without any schema information?

Read More

There's a Bug with Extended Events creation in SQL Server Management Studio 18.7: what it is and a workaround

UPDATE 2: The bug was fixed in SSMS 18.8 UPDATE: The bug still isn’t fixed in SSMS 18.

Read More

How to ship SQL Jupyter Notebooks and Books directly to Azure Data Studio by creating an extension in the Marketplace

The recently released Extension Generator for Azure Data Studio has opened up yet another way to ship Notebooks and Books to ADS allowing you to easily author your extensions.

Read More

You can now script your database objects as a Notebook using SQL Server Management Studio 18.5+

Great News Everyone! Microsoft just dropped SSMS 18.5 after almost 5 long months without any updates; this new release fixes a lot of bugs and introduces a few new features, above them all I’m now showing you the following.

Read More

How to update a SQL Server container on Docker for Windows (spoiler - there is a catch)

With the 1st CU for SQL 2019 released just yesterday, and Microsoft updating the docker image right away, the only natural response for me was to update the docker instance that I showed you how to deploy a few months back.

Read More

Why RDP'ing into a SQL machine is a bad idea

Guys, you should stop doing this, there are reasons if it’s not recommended to log into the SQL Server Machine via RDP as opposed to using a client on your PC (or another machine).

Read More

Get faster performance and lower network usage in SQL Server Loops by avoiding the "DONE Token" overload

FYI: You can get the Notebook for this article on my github and experiment yourself (opens with Azure Data Studio ).

Read More

How to identify the unit of measure of Extended Events durations

Even if I use Extended Events almost every day, I always forget the unit of measure of each duration counter, since they’re basically arbitrary; Seconds, milliseconds, microseconds?

Read More

Quickly move data between instances for testing using only PowerShell

Quick tip, how many times did a dev ask you to move the PROD/QA data to DEV to test a feature?

Read More

Cast any string directly to XML with auto-escaping characters in SQL Server

Recently I had to look up the definition for a bunch of SQL objects and didn’t want to manually retrieve them manually in SSMS (with Create Scripts) or Visual Studio (by searching the object name in my TFS repository).

Read More

How to Show Better Execution Plans in Azure Data Studio

Azure Data Studio is starting to mature and some neat features are coming to the vscode-based (and now multidatabase and multiplatform) tool.

Read More

Load data directly in SQL Server from a xlsx file, without OLEDB or Excel, using Powershell

I don’t know you, but people from other BU are old fashioned guys that do everything by hand, and then send you an Excel file to “put this data in the database” or “find info related to this codes”.

Read More

Why identity values can jump by the 1000's ? Is it normal?

It must have happened you at least once to find identity columns with values that from one row to the next one jump by 1000’s rows, of course without having anyone deleting the rows in between, how this occurs?

Read More

A quick function to remove (or keep only) string patterns from SQL Server Strings

Working with strings in SQL Server isn’t as easy or powerful as using any programming language, but, I’m sure that more than once you had to to some data manipulation directly in the database, this may help you out, and it doesn’t use Loops, CLR or XML

Read More

How to populate a PowerBI Dataset from a REST API, using PowerBI's REST API, without any code (via Microsoft Flow)

I was wondering if PowerBI could be used for reporting on Live data, not coming from my Database using DirectQuery (or the new super neat composite mode ) with with a Streaming Dataset, which I never used before, so, I got to work.

Read More

SQL Server: How to Find a safe restore point (and who messed up) by reading from the Transaction Log

Panic: Someone has messed up and deleted a super important piece of information in a table!

Read More

A script to automatically align columnstore indexes to enhance segment elimination (and hence performances)

Columstore indexes are a “new” neat data structure that I like, even if technically they’ve been around for years, only recently they’ve become usable by most customers.

Read More

Tracking Dynamic SQL performance automatically with a wrapper on sp_executesql (Dynamic SQL Inception)

in some projects I have a lot of Dynamic SQL going on, some queries are fast, some queries are slow, it depends on how the dynamic statement is actually put together ¯\_(ツ)_/¯ Tracking the performance of such statements is usually difficult because you don’t really know “why it’s slow” and you have to interpolate data from the app and the plan cache (if the plan is still there and wasn’t purged due to memory pressure) and try to figure out which was the piece of the offending dynamic SQL and why it did that.

Read More

A clarification on the waitstat: SOS_SCHEDULER_YIELD

Are you one of the people that says “we have a CPU related issue” whenever it sees SOS_SCHEDULER_YIELD popping up?

Read More

What's the best way to massively update a big table?

A thing that can happen once in a while in a DW is the need to massively update a column in a table, let’s find out.

Read More

How to get and decode callstacks in in extended events for recent versions of SQL Server

The other day I was reading about spinlocks and troubleshooting and it mentioned to get the callstack for a certain xevent and to decode it using the windows debugging symbols, however, that material was related to SQL Server 2012 and the steps weren’t basically replicabile for a modern version like SQL 2016/2017 (or even 2014 I think, but haven’tn checked personally), I searched around and didn’t really find something straight forward for just the process as it is now: So, here we are, small guide on how to get and decode callstacks in recent versions of SQL Server.

Read More

Create an asynchronous multithreaded workflow on your SQL Server using the Service Broker

As any other *Server, SQL Server is born with concurrency in mind, a lot of users/applications can connect concurrently and do their job, as designed, perfect, but, what if you’re the only user?

Read More