Redis ZRANGEBYLEX Replacement

Starting with Redis 6.2.0, the ZRANGE command added the REV, BYSCORE, BYLEX and LIMIT options. The addition of the first three options means that the ZRANGE command can now do what the ZREVRANGE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZRANGEBYLEX and ZREVRANGEBYLEX commands can do.

As a result, those commands are now deprecated (as of Redis 6.2.0).

Therefore, we should no longer use the ZRANGEBYLEX command. Instead, we should use the ZRANGE command with the BYLEX argument.

Continue reading

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

If you’re getting an error that reads “ERR wrong number of arguments for ‘smismember’ command” in Redis, it’s because you’re calling the SMISMEMBER command with the wrong number of arguments.

To fix this issue, make sure you’re passing the correct number of arguments. This command accepts two or more arguments, which represents a key and one or more members to check against that key.

Continue reading

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.

Continue reading

Fix “NEXT VALUE FOR function does not support the PARTITION BY clause.” (Error Msg 11716) in SQL Server

If you’re getting an error that reads “NEXT VALUE FOR function does not support the PARTITION BY clause” in SQL Server, it’s probably because you’re trying to use the PARTITION BY sub clause in an OVER clause when using NEXT VALUE FOR to increment a sequence object.

In other words, the NEXT VALUE FOR function does not support the PARTITION BY sub clause of the OVER clause.

To fix this issue, either remove the PARTITION BY clause or change the statement to use another method for partitioning the results.

Continue reading

Redis ZREVRANGEBYSCORE Replacement

Starting with Redis 6.2.0, the ZRANGE command added the REV, BYSCORE, BYLEX and LIMIT options. The addition of the first three options means that the ZRANGE command can now do what the ZREVRANGE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZRANGEBYLEX and ZREVRANGEBYLEX commands can do.

As a result, those commands are now deprecated (as of Redis 6.2.0).

Therefore, we should no longer use the ZREVRANGEBYSCORE command. Instead, we should use the ZRANGE command with the REV and BYSCORE argument.

Continue reading

Fix “WRONGTYPE Operation against a key holding the wrong kind of value” when using ZUNION or ZUNIONSTORE in Redis

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

To fix this issue, make sure the keys you pass to these commands contain either sets or sorted sets. Although these commands are for sorted sets, they also work with non-sorted sets.

Continue reading

Redis ZREVRANGE Replacement

Starting with Redis 6.2.0, the ZRANGE command added the REV, BYSCORE, BYLEX and LIMIT options. The addition of the first three means that the ZRANGE command can now do what the ZREVRANGE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZRANGEBYLEX and ZREVRANGEBYLEX commands can do.

As a result, those commands are now deprecated (as of Redis 6.2.0).

Therefore, we should no longer use the ZREVRANGE command when we need to return a sorted set in descending order. Instead, we should use the ZRANGE command with the REV argument.

Continue reading