Fix Error Msg 8115 “Arithmetic overflow error converting expression to data type…” in SQL Server

If 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 reading

Fix Error 9809 “The style … is not supported for conversions from … to …” in SQL Server

If 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 reading

Fix “WRONGTYPE Operation against a key holding the wrong kind of value” when using ZPOPMIN, ZPOPMAX, BZPOPMIN, or BZPOPMAX in Redis

If you get an error that reads “WRONGTYPE Operation against a key holding the wrong kind of value” when using the ZPOPMIN or ZPOPMAX commands in Redis, it’s because you’re passing a key with the wrong data type.

The same issue can apply when using the blocking variants of these commands (BZPOPMIN and BZPOPMAX).

To fix this issue, make sure you pass a sorted set to these commands.

Continue reading

Fix “Cannot drop a default constraint by DROP DEFAULT statement. Use ALTER TABLE to drop a constraint default.” in SQL Server

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.

Continue reading

Fix “ERR wrong number of arguments for ‘hstrlen’ command” in Redis

If you’re getting an error that reads “ERR wrong number of arguments for ‘hstrlen’ command“, it’s because you’re passing the wrong number of arguments when using the HSTRLEN command.

The HSTRLEN command requires two arguments (at the time of writing). These are the name of the key and the name of the field.

If you’re getting this error, check the number of arguments that you’re passing and adjust if required.

Continue reading

Fix “ERROR 1054 (42S22): Unknown column ‘…’ in ‘on clause'” in MySQL

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 column doesn’t exist.
  • You’re trying to reference an aliased column by its column name.
  • Or it could be the other way around. You could be referencing the column with an alias that was never declared.
Continue reading

Fix Error “1064 (42000): You have an error in your SQL syntax…” When Trying to Convert to an Integer in MySQL

If you’re getting error number 1064 that reads something like “1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘INTEGER )’ at line 1“, it could be that you’re using the wrong term for the integer.

MySQL doesn’t let us use just the INTEGER keyword when converting to an integer. We need to use either SIGNED or UNSIGNED, optionally followed by INTEGER or INT. When we do this, it produces a signed or unsigned BIGINT value.

Continue reading

Fix Msg 3728 in SQL Server “… is not a constraint”

If you’re getting an error that reads something like “Msg 3728, Level 16, State 1, Line 1
‘DF__Dogs__DogId__6FE99F9F’ is not a constraint
“, it’s probably because you’re trying to drop a constraint that isn’t in the database.

To fix this issue, check to make sure the constraint exists before dropping it. Alternatively, use the IF EXISTS clause to drop the constraint only if it exists.

Continue reading