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