Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Operand data type bit is invalid for min operator
From Wiki
You will get the Operand data type bit is invalid for min operator error message when you try to use the MIN function on a bit data type.
Let's take a look, first create this table
- create table #test (Col bit)
- insert #test values (1)
- insert #test values (0)
- go
Below is the query that will produce the Operand data type bit is invalid for min operator error
- select Min(Col) from #test
Msg 8117, Level 16, State 1, Line 1
Operand data type bit is invalid for min operator.
In order to use the MIN function on a bit column, you need to convert to something that the MIN function does work with. In this case we can convert to int
- select Min(convert(int,Col)) from #test
Here is what the error message looks like in other languages as stored in sys.messages
us_english
Operand data type %ls is invalid for %ls operator.
Deutsch
Der Operanddatentyp %1! ist für den %2!-Operator ungültig.
Français
Le type de données de l'opérande %1! n'est pas valide pour l'opérateur %2!.
日本語
オペランドのデータ型 %1! は %2! 演算子では無効です。
Español
El tipo de datos %1! del operando no es válido para el operador %2!.
Italiano
Tipo di dati di operando %1! non valido per l'operatore %2!.
русский
Тип данных операнда %1! недопустим для оператора %2!.
Português (Brasil)
O tipo de dados de operando %1! é inválido para o operador %2!.
繁體中文
%2! 運算子的運算元資料類型 %1! 無效。
한국어
%2! 연산자에 대한 피연산자 데이터 형식 %1!이(가) 잘못되었습니다.
简体中文
操作数数据类型 %1! 对于 %2! 运算符无效。
Contributed by: --SQLDenis 15:22, 22 August 2010 (GMT)
Part of Common SQL Server Errors
Section Integer Data Types



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.