If you have a MongoDB collection with dates stored as strings, you can convert those into the Date BSON type if required.
Below are three ways to convert a string into a Date in MongoDB.
If you have a MongoDB collection with dates stored as strings, you can convert those into the Date BSON type if required.
Below are three ways to convert a string into a Date in MongoDB.
Occasionally you might find yourself in the situation where you need to get the name of the current workstation that’s connected to SQL Server.
For example, maybe you have a stored procedure that inserts data, and you want to record the name of the workstation that inserted the data.
In such cases, you can use the HOST_NAME() function.
This is not to be confused with getting the server name.
In Oracle, the RPAD() function allows you to pad the right part of a string with a certain character, to a specified number of characters.
The way it works is, you specify how long the resulting string should be. If the original string is shorter, the padding character fills in the remaining space.
In Oracle, the LPAD() function allows you to pad the left part of a string with a certain character, to a specified number of characters.
The way it works is, you specify how long the resulting string should be. If the original string is shorter, the padding character fills in the remaining space.
Two similar functions in MariaDB are FIELD() and FIND_IN_SET(). At first glance, these appear to do the same thing, but there is a difference.
This article looks at the difference between these two functions.
In Oracle, the TRANSLATE() function allows you to make several single-character, one-to-one substitutions in one operation.
It returns the string provided as a first argument after some characters specified in the second argument are translated into a destination set of characters specified in the third argument.
It’s similar to the REPLACE() function, except that the REPLACE() function replaces the whole string with another string (i.e. not character by character, like TRANSLATE() does).
In Oracle, the NLSSORT() function returns a collation key for a given character value and an explicitly or implicitly specified collation.
The function can be useful for performing comparisons against string values based on a specified collation.
Ever since version 10.3.1, MariaDB has included both a LENGTH() function and a LENGTHB() function.
That second one has a B at the end of the name. So it’s kind of like Length A and Length B, except that Length A doesn’t have the A.
Confused?
I was, when I first encountered LENGTHB(). I already knew about LENGTH(), so why the need for a “B” version?
Let’s find out.