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, without any schema information whatsoever, and you have to dump it in your database as-is, and then have to spend precious time to figure out the data type for each column?
Let me help you with that, as I'm helping myself too
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.8UPDATE: The bug still isn’t fixed in SSMS 18.7.1 Oh boy, what I found; I haven’t seen anybody else reporting on it, yet, so here I am.Fortunately, the bug is not breaking, as I’ve found a workaround, but still. Repro Open the “New Session…” GUI for extended events in SSMSGive it a name, it’s not importantAdd an...
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. In my previous post I’ve detailed how you can now access a Book remotely, now, if you want the book to be actually installed in your ADS instance, you can install it as an extension! Follow this link for the SQL...
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. I’m sure that you used the the “Generate Scripts” feature in SSMS quite a few times, you could generate the code for schema and/or data for any (or...
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. The theory In theory, a docker container can’t be really “updated”, they’re meant to be stateless machines that you spin up and down responding to...
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). PS: These recommendations are valid for any DMBS, not only SQL Server You’re stealing resources from SQL Server Probably you’re logging into your server because there is a problem, do you really want...
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). Preamble Everybody knows that using loops in SQL Server is not efficient, if you’re able to write that same logic in a set-based statement it’s guaranteed to be faster.Still, devs can’t be helped, you just can’t seem to nail down the set-equivalent statement...
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? Whatever, it depends on the dev that implemented that specific counter. That’s why I’ve added to Tsql.tech Github repository the following code that extracts the descriptions from XE DMVs in order to...
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? Of course, not the whole DB, which would be too easy via a scripted backup/restore, but only a single table, or subset of table data? How do you deal with it usually? With the SSMS Import data Wizard? (ugh..) Exporting to flat file and reimporting? Linked Servers? External tools? Restore the whole...