How to Concatenate Strings in SQL

Most of the major RDBMSs provide several options for concatenating two or more strings.

  • There’s the CONCAT() function, which concatenates its arguments.
  • There’s also a CONCAT_WS() that allows you to specify a separator that separates the concatenated strings.
  • And there’s also a string concatenation operator, which allows us to concatenate its operands.

Below are examples of each method.

Continue reading

How to Change the Recovery Model of a Database in Azure SQL Edge using T-SQL

By default, databases created with Azure SQL Edge use the simple recovery model. This means that you can’t perform log backups on these databases.

If you need to perform log backups on a database created with SQL Edge, you’ll need to change the recovery model of the database to either full or bulk logged.

This can be done with T-SQL with the ALTER DATABASE statement.

Continue reading

About the DATE_BUCKET() Function in Azure SQL Edge

T-SQL includes a DATE_BUCKET() function that allows you to arrange data into groups that represent fixed intervals of time. It returns the datetime value that corresponds to the start of each datetime bucket, as defined by the arguments passed to the function.

As far as I’m aware, the DATE_BUCKET() function is only available in Azure SQL Edge at the time of this writing.

Update: DATE_BUCKET() was introduced in SQL Server 2022.

Continue reading

How to Install SQL Server on an M1 Mac (ARM64)

I previously explained how to install SQL Server on a Mac using the SQL Server for Linux Docker image.

Since then, Apple has released its M1 chip, which uses ARM architecture. This can cause a problem when trying to install SQL Server. The problem is, at the time of writing, SQL Server isn’t supported on the ARM architecture.

Fortunately, there’s an alternative.

Continue reading