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

How to Specify the Data Type when Creating a Sequence in SQL Server

When creating a sequence object in SQL Server, the default data type is bigint. However, we can change this so that the sequence uses a data type of our choosing, as long as it’s an integer type (see below for accepted data types).

We can set the data type of a sequence by using the AS argument when defining the sequence.

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

How to Create a Repeating Sequence in SQL Server

When we create a sequence object in SQL Server, we have the option of making it a repeating sequence or a nonrepeating sequence. By repeating I mean, we can have the sequence continually start again once the min/max value has been reached. In other words, we can have the sequence reiterate over and over again.

We can do this with the CYCLE argument.

Continue reading

Fix “WRONGTYPE Operation against a key holding the wrong kind of value” when Setting a Hash in Redis

If you get an error that reads “WRONGTYPE Operation against a key holding the wrong kind of value” when setting a hash with a command like HSET or HSETNX, it’s probably because you’re trying to set a non-hash key that already exists. In other words, the key already exists, but it doesn’t contain a hash.

To fix this issue, be sure to use these commands on keys that either don’t already exist, or contain a hash.

Continue reading