Home

What is the solution to the error "Operand should contain 1 column(s)"?

Alton Alexander
By Alton AlexanderUpdated on June 4th, 2022

An operand must contain at least one column. This error code occurs when a user attempts to operate on a data set that has no columns.

You are here because you have a question about:

  • error code: 1241. operand should contain 1 column(s)
  • operand should contain 1 column s

1. Use the CONCAT function to concatenate multiple columns into one column

To use the CONCAT function to concatenate multiple columns into one column in order to fix operand should contain 1 column, follow these steps:

  1. Open the Excel spreadsheet where you want to concatenate the columns.
  2. In the first column, type the values for the first column that you want to concatenate.
  3. In the second column, type the values for the second column that you want to concatenate.
  4. In the third column, type the values for the third column that you want to concatenate.
  5. In the last column, type the values for the last column that you want to concatenate.
  6. Click theCONCAT button.
  7. The CONCAT function will combine the values in the first, second, and third columns into one column.

2. Use the UNPIVOT function to convert columns into rows

The UNPIVOT function can be used to fix an operand that should contain 1 column, into a row that contains the data in the first column of the table. The syntax for the UNPIVOT function is as follows: UNPIVOT(column_name, table_name, [expression]) The column_name argument is the name of the column in the table that will contain the data to be converted. The table_name argument is the name of the table from which the data will be copied. The expression argument is an optional expression that will be used to determine the value to be returned for the column_name argument. If the expression argument is not provided, the value in the column_name column will be used.

3. Use the PIVOT function to convert rows into columns

The PIVOT function can be used to fix an operand that should contain 1 column, so that the result will be in the correct column. To use the PIVOT function, you first need to specify the column you want the result to be in. Next, you need to specify the number of rows you want to convert. Finally, you need to specify the function to use.

Still not working? maybe try one of these options:

  1. Use a CTE to concatenate multiple columns into one column.
  2. Use a subquery to concatenate multiple columns into one column.