PostgreSQL provides us with a couple of functions that allow us to pad strings. We can use these functions to put one or more space characters or other characters on either the right side, left side, or both sides of the string.
Continue readingTag: string
3 Ways to Concatenate Strings in PostgreSQL
When working with databases (and software in general), string concatenation is the operation of joining character strings end-to-end. For example if we have two words, we can combine them into one.
PostgreSQL provides us with multiple ways to concatenate strings. Below are two functions and one operator that we can use to concatenate strings in PostgreSQL.
Continue readingConverting Between Uppercase and Lowercase in PostgreSQL
PostgreSQL provides us with a few functions that we can use to convert strings between uppercase and lowercase.
We can convert the whole string to uppercase or lowercase, or we can convert it to initial caps, where the first letter of each word is uppercase and the rest of the word is lowercase.
Continue reading4 Functions that Trim a String in PostgreSQL
PostgreSQL provides us with various string functions, including some that allow us to trim a given string on both sides or a given side.
Below are four functions that we can use to trim strings in PostgreSQL.
Continue readingConcatenate Array Elements into a String in PostgreSQL
You may be aware that PostgreSQL has a couple of functions that allow us to concatenate strings. In particular, the concat()
function allows us to concatenate multiple strings into one string, and the concat_ws()
function allows us to do the same, but to also specify a separator for the concatenated strings.
But did you know that we have the ability to pass an array to these functions?
Continue readingSome Handy T-SQL String Manipulation Techniques
Transact-SQL (T-SQL) offers a nice set of functions and methods for manipulating strings. Let’s look at some handy techniques that can help us work more efficiently with string data in SQL Server.
Continue readingUsing the VARIADIC Keyword with the FORMAT() Function in PostgreSQL
When we use the format()
function in PostgreSQL, we can pass any number of strings to insert into the resulting formatted string in positions that are specified in the first argument. When we do this, we might typically pass the strings as separate arguments. But this isn’t the only way to do it.
We have the option of passing the strings as array elements. That is, we can pass an array to the function, and have it extract each array element as though it’s a separate argument to insert into the formatted string.
Continue readingCheck Whether a Unicode String is Normalized in PostgreSQL
In PostgreSQL, we can use the ... IS NORMALIZED
expression to check whether or not a given Unicode string is in a specified Unicode normalization form.
By default, it checks whether it’s in the NFC
form, but we also have the option of specifying NFD
, NFKC
, or NFKD
.
2 Functions that Return the Position of a Substring within a String in PostgreSQL
PostgreSQL sometimes provides us with multiple functions that basically do the same thing. Such is the case with the following two functions that return the position of a given substring within a string.
Continue readingDate Formats Accepted by SQL Server’s datetime2 Type
Below are the string literal date formats that SQL Server supports for the datetime2 data type. These are the formats that we can provide when setting a datetime2 date from a string literal.
Continue reading