When creating a sequence object in SQL Server, it’s common to set various properties such as the start value, the increment, and even things like the maximum and minimum values for the sequence. But it is also possible to create a sequence without setting any of these properties.
Continue readingTag: how to
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 readingRedis 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.
6 Ways to Clone a Table in PostgreSQL
PostgreSQL provides us with several options when it comes to cloning a table. Below are six methods we can use to clone a table in Postgres. The method we use will depend on things like, whether or not we want to transfer the data, indexes, etc.
Continue readingFix “WRONGTYPE Operation against a key holding the wrong kind of value” when using LRANGE in Redis
If you get an error that reads “WRONGTYPE Operation against a key holding the wrong kind of value” when using the LRANGE
command, it’s probably because you’re passing a key with the wrong data type.
To fix this issue, be sure that the key you pass to the LRANGE
command holds a list.
Get All Parameters from a SQL Server Database (T-SQL)
In SQL Server we can query the sys.parameters
system catalog view to return all parameters that belong to user-defined objects.
For system objects, we can query the sys.system_parameters
view. We can alternatively query the sys.all_parameters
system catalog view to return all parameters that belong to either user-defined or system objects.
Redis ZRANGEBYSCORE 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 ZRANGEBYSCORE
command when we need to return a sorted set by score. Instead, we should use the ZRANGE
command with the BYSCORE
argument.
How to Create a Synonym in SQL Server (T-SQL)
In SQL Server we can create synonyms, which allow us to provide an alternative name for a database object. Once created, we can reference the synonym instead of the object itself.
Continue readingFix ERROR 1050 (42S01) “Table … already exists” in MySQL
If you’re getting an error that reads something like “ERROR 1050 (42S01): Table ‘customers’ already exists” when trying to create a table in MySQL, it’s probably because there’s already a table in the database with the same name.
To fix this issue, either change the name of the table you’re trying to create, or check the existing table to see if it’s the one you actually need.
Continue reading3 Ways to Clone a Table in MariaDB using SQL
We have several options when it comes to using SQL to clone a table in MariaDB. And we have the option to clone the table with data, or without data.
Here are three SQL options for cloning a table in MariaDB.
Continue reading