Below is a list of numeric styles supported by the CONVERT() function in SQL Server. These are the styles that can be used as the third argument to indicate how the input value is formatted.
convert
How PARSE() Works in SQL Server
In SQL Server, the PARSE() function returns the result of an expression, translated to the requested data type.
Basically, it enables us to parse a string expression to the specified data type. It’s intended for converting string values to either date/time or number types.
The PARSE() function can be handy when attempting to convert with CAST() or CONVERT() fails. The PARSE() function is able to parse the expression, and this may result in certain values being converted that wouldn’t normally be able to be converted.
How to Convert Dates in SQL Server
When it comes to converting date and time values in SQL Server, things can get a little complex. But in this article I hope to demystify this topic for anyone who’s confused when it comes to making conversions between dates and other data types, as well as changing the format of date/time values, and other considerations.
Let’s jump straight in.
3 Ways to Convert an Integer to Decimal in SQL Server
Here are three options for converting an integer to a decimal value in SQL Server using T-SQL.
Data Type Precedence in SQL Server
Below is a list containing the SQL Server data types, in order of precedence.
3 Ways to Convert a String to 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.
3 Ways to Convert a Date to a String in MongoDB
MongoDB has a Date BSON type that allows you to store dates as dates.
You can also store dates as strings, if that’s what you need.
Taking it a step further, you can also convert a Date to a string.
This article presents three ways to convert a Date to a string in MongoDB.
How CONVERT() Works in MariaDB
In MariaDB, CONVERT() is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.
You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.
CONVERT() is similar to CAST().
How CAST() Works in MariaDB
In MariaDB, CAST() is a built in function that converts a value to another data type. It takes a value of one type and returns a value of the specified type.
You provide the value as an argument when you call the function, as well as the type that you’d like it converted to.
CAST() works similar to CONVERT().
Convert a Date to Another Time Zone in SQL Server
The AT TIME ZONE clause was introduced in SQL Server 2016 to convert a date into a datetimeoffset value in a target time zone.
This function is similar to some other T-SQL functions, such as SWITCHOFFSET() and TODATETIMEOFFSET(), however, the AT TIME ZONE clause allows/(requires) you to specify the time zone offset by name, instead of an actual offset value.
This article explores how AT TIME ZONE works, and explains its benefits when compared to the other functions mentioned.