How the QUOTENAME() Function Works in SQL Server (T-SQL)

In SQL Server, the T-SQL QUOTENAME() function returns a Unicode string with the delimiters added to make the input string a valid SQL Server delimited identifier.

It was designed for quoting databases and their objects.

The function accepts two arguments; the input string (required), and a delimiter character (optional).

Continue reading

MySQL CHAR() vs T-SQL CHAR(): What’s the Difference?

There are many functions that are included in both MySQL and SQL Server. However, just because both DBMSs share functions of the same name, doesn’t mean that those functions work exactly the same way.

Take CHAR() for example. Both MySQL and SQL Server include this function. Well technically, for SQL Server it’s actually a T-SQL function, but that’s beside the point. The point is that the MySQL CHAR() function provides more functionality than the T-SQL/SQL Server CHAR() function.

In particular, the MySQL version accepts multiple integers, whereas, the T-SQL version only accepts a single integer. The MySQL version also accepts a USING clause that allows you to specify which character set to use (the T-SQL version doesn’t have this clause).

Below are some examples of these differences.

Continue reading

Create a SQL Server Database with Azure Data Studio

Here, I explain how to use Azure Data Studio (formerly SQL Operations Studio) to create a database in SQL Server.

In my case, I’m running SQL Server on a Mac (via a Docker container), but these instructions are generic and should work exactly the same way on Linux and Windows.

This tutorial assumes you already have Azure Data Studio installed on your machine, and you’ve connected to your SQL Server instance. If you don’t have Azure Data Studio installed on your machine, here are instructions for installing it on a Mac and connecting to SQL Server via Docker.  The Azure Data Studio installation is pretty straightforward (you install it just like any other software), so if you’re on Linux or Windows, you shouldn’t have any issues.

Continue reading