MariaDB has an LPAD()
function that allows us to pad the left part of a string or number with our chosen character or series of characters.
We can use this function on numeric values in order to add leading zeros.
Continue readingMariaDB has an LPAD()
function that allows us to pad the left part of a string or number with our chosen character or series of characters.
We can use this function on numeric values in order to add leading zeros.
Continue readingIn PostgreSQL, we can use the TO_CHAR()
function to add leading zeros to a number. The function converts the number to a string, using the (optional) format we specify.
Another option is to use the LPAD()
function to pad a number with leading zeros.
Azure SQL Edge uses a limited version of the SQL Server Database Engine. One of the limitations of Azure SQL Edge, is that it doesn’t currently support CLR-dependent T-SQL functions, such as the FORMAT()
function.
This can be a problem when trying to format numbers.
However, there are often ways around such limitations. Here are examples of how we can pad numbers with leading and trailing zeros in SQL Edge.
Continue readingSome DBMSs have an LPAD()
and RPAD()
function which can be used to pad numbers with leading and trailing zeros.
SQL Server doesn’t have such a function. But that doesn’t prevent us from being able to pad numbers with leading/trailing zeros.
Continue readingWhen using SQLcl or SQL*Plus with Oracle Database, you may have noticed feedback at the bottom of your query results that tells you how many rows were selected. For example, 100 rows selected
(or however many rows were returned).
If you want to get rid of this, you can use SET FEEDBACK OFF
.
You also have the option of setting a row threshold, which allows you to specify how many rows should be returned before feedback is provided.
Continue readingThere are many ways to perform date arithmetic in MariaDB. This includes adding or subtracting a certain number of a given date part from a date or datetime value.
In this article, I present 8 ways to add an hour to a datetime value in MariaDB.
Continue readingSome RDBMSs provide an LPAD()
and RPAD()
function that enables us to left pad or right pad a string. Some functions also allow us to add leading or trailing zeros numbers.
Below are examples of applying SQL padding in some of the more popular RDBMSs.
Continue readingIn Azure SQL Edge, you can query the sys.databases
catalog view to see the recovery model for each database.
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.
Continue readingIf 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.
Continue reading