PostgreSQL provides us with the following ways to concatenate strings and numbers:
- The
CONCAT()function, which concatenates its arguments. - The pipe concatenation operator (
||), which concatenates its operands.
Examples of each below.
PostgreSQL provides us with the following ways to concatenate strings and numbers:
CONCAT() function, which concatenates its arguments.||), which concatenates its operands.Examples of each below.
If you get an error that reads The statement BACKUP LOG is not allowed while the recovery model is SIMPLE when trying to back up a database in SQL Server or Azure SQL Edge, it’s because you’re trying to back up the transaction logs on a database that uses the simple recovery model.
To fix this, change the recovery model to either full or bulk logging.
In SQL Server, the TODATETIMEOFFSET() function was specifically designed to return a datetimeoffset value from a datetime2 value.
Given the fact that the datetime2 data type doesn’t actually support time zone offsets, and datetimeoffset must contain the offset, the TODATETIMEOFFSET() function allows you to specify a time zone offset to use.
This article provides some examples to demonstrate.
MariaDB has the FORMAT() function, which formats a number based on the given format string.
It returns the number as a formatted string, with thousands and decimal separators in the appropriate position and rounds the result to the specified decimal position.
You can optionally specify a locale value to format numbers to the pattern appropriate for the given region.
Most of the major RDBMSs provide several options for concatenating two or more strings.
CONCAT() function, which concatenates its arguments.CONCAT_WS() that allows you to specify a separator that separates the concatenated strings.Below are examples of each method.
In SQL Server, you can use the LOGINPROPERTY() to return information about login policy settings.
This includes being able to return data for bad password attempts, as well as the time of the last failed login attempt due to a bad password.
In PostgreSQL, we can use the TO_CHAR() function to format numbers in a given format. This includes formatting numbers with commas in the relevant location.
PostgreSQL also has a money data type, which outputs the value using the current locale. This can include commas in the appropriate place, based on the locale being used.
Most of the major RDBMSs have functions that enable us to extract the day, month, and year from datetime values.
Some RDBMSs provide multiple ways to do this, and others are more limited. Below are examples of extracting the day, month, and year from date values in some of the most popular RDBMSs.
SQL Server provides us with a quick and easy way to format numbers with commas inserted at the relevant place. For example, 1234.56 can become 1,234.56. Or it can become 1.234,56, if that’s the locale that you’re using.