In MySQL, COLLATION()
is a built in function that returns the collation of its string argument.
We provide the string when we call the function.
Continue readingIn MySQL, COLLATION()
is a built in function that returns the collation of its string argument.
We provide the string when we call the function.
Continue readingIn MySQL, CHARSET()
is a built in function that returns the character set of its string argument.
We provide the string when we call the function.
Continue readingIf you’re getting error msg 8115 that includes the message Arithmetic overflow error converting expression to data type…, it’s probably because you’re trying to convert a value to a data type that can’t handle that value. For example, trying to convert a number to a tinyint but the number’s too big to fit into a tinyint.
To fix this issue, make sure you convert the value to a data type that can handle the size of the value that you’re trying to convert.
Continue readingIf you’re getting error msg 9809 which reads something like The style … is not supported for conversions from … to … in SQL Server, it’s probably because you’re trying to convert between data types, but the style that you’re specifying isn’t supported for that operation.
It’s not that the conversion can’t happen, it’s just that the style that you’re providing is wrong.
Continue readingIn SQL Server, we can use functions like CONVERT()
or FORMAT()
to convert a valid date type into a format like yyyymmdd.
This format adheres to the ISO 8601 standard, which defines dates to be written as yyyymmdd, or when using delimiters, as yyyy-mm-dd.
In SQL Server, the date type expresses dates in the yyyy-mm-dd format, but we can use the following technique to remove the delimiters and express the date as yyyymmdd.
Continue readingWhen working with SQL Server, if we’re given a number that represents a date in the yyyymmdd format, we can use functions like CAST()
or CONVERT()
to convert that number to a valid date type. This will enable us to perform date operations against it that we might not be able to do when it’s still in numeric form.
If you’re getting an error that reads something like “Cannot drop a default constraint by DROP DEFAULT statement. Use ALTER TABLE to drop a constraint default“, it’s because you’re trying to use DROP DEFAULT
to drop a DEFAULT
constraint.
The DROP DEFAULT
statement has been flagged for deletion from SQL Server, and Microsoft recommends that we use the ALTER TABLE
statement to drop DEFAULT
constraints.
Therefore, to fix this issue, use the ALTER TABLE
statement to drop the DEFAULT
constraint.
If you’re getting an error in MySQL that reads something like “ERROR 1054 (42S22): Unknown column ‘c.DogName’ in ‘on clause”“, here are three likely causes:
The following is a list of date and time functions available in MySQL. Click on each function name to see an explanation of the function, its syntax, and examples.
Continue readingIn MySQL, 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.
We provide the value as an argument when we call the function, as well as the type that we want it converted to.
The CONVERT()
function is similar to the CAST()
function, which also converts between data types.