On a week long theme on XML and JSON in SQL Server, this is the second post. After the first post of just showing how to store these values in the database I am going to take a look at how big the data is and how much we can compress each one with row and page level compression. Lets …

SQL 2019 Page and Row Compression with XML and JSON Read more »

This post is the first in a series of blog posts around using XML and JSON in SQL Server. XML has been supported, although slightly clunky since SQL Server 2005, and it has not changed much. Later versions of SQL Server introduce some JSON parsing which is different from how XML is represented in that JSON data is just stored …

JSON and XML in SQL Server Read more »

Here is a quest that was submitted on the blog today. HelloJust have a question about a table of mineone of the columns is of type text and its of estimated size of 128gb (99%)Now I do not have permissions to remove the column, but I was told that I can remove data from it (to save space).But of course, …

Setting text field to empty or null does not release the space used Read more »

Recently I had a project where I needed to add a number of logins as SQL Server sysadmin users to several SQL Server instances. Rather than spending hours clicking through the SSMS dialogs to add those users I decided to script it out. The requirement was the given a list of usernames and passwords the user be added as a …

Script to bulk add SysAdmins to SQL Server Read more »

When you execute xp_cmdshell SQL Server runs a command at the operating system level similar to the old DOS prompt, or CMD shell. There are many security concerns and misconceptions about xp_cmdshell as documented in an earlier post. The purpose of this post is not to debate whether xp_cmdshell is safe or not, but instead to show what user commands …

Who does SQL Server run xp_cmdshell command as? Read more »

Posted 3/29/2020 — Edited 3/30/2020 to fix a couple of copy and paste errors, and to clarify a couple of items. Thanks Charlie for your suggestions. I have worked on many projects that involved doing some query work then writing those results to a file. After copying and pasting the typical sp_OA… methods to write to a file too many …

SQL Server – Writing to a File Read more »