简体   繁体   English

尝试在参数中添加“ ALL”选项时,操作数类型冲突uniqueidentifier与int不兼容

[英]operand type clash uniqueidentifier is incompatible with int when trying to add 'ALL' option to my parameter

I created a drop down menu by getting values from the query. 我通过从查询中获取值创建了一个下拉菜单。 Now, I am trying to add "All" as the option instead of using multi select. 现在,我尝试添加“全部”作为选项,而不是使用多选。 I want the user either to select "All" or 1. Below is the query I am using and I run into this error message 我希望用户选择“全部”或1。以下是我正在使用的查询,并且遇到此错误消息

operand type clash uniqueidentifier is incompatible with int 操作数类型冲突uniqueidentifier与int不兼容

 select departmentid, name from department
 union
 select -1, 'ALL'

How can I add 'ALL' option and not run into this error? 如何添加“全部”选项而不会遇到此错误?

How about using NULL instead? 改用NULL怎么样?

select NULL, 'ALL'

Or generating an id on the fly? 或即时生成ID?

select newid(), 'ALL'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 操作数类型冲突:uniqueidentifier与查询中的int不兼容 - Operand type clash: uniqueidentifier is incompatible with int in query 操作数类型冲突:uniqueidentifier与int不兼容 - Operand type clash: uniqueidentifier is incompatible with int 操作数类型冲突:当我尝试更新数据库时,int与日期不兼容 - Operand type clash: int is incompatible with date when I am trying to update my database 操作数类型冲突:uniqueidentifier 与 float 不兼容 - Operand type clash: uniqueidentifier is incompatible with float 操作数类型冲突:尝试使用动态 Sql 时日期与 int 不兼容 - Operand type clash: date is incompatible with int when trying to use dynamic Sql 操作数类型冲突:int 与日期、UNION ALL、NULL 值不兼容 - Operand type clash: int is incompatible with date, UNION ALL, NULL value 操作数类型冲突:日期与带有 CASE WHEN 的 int 不兼容 - Operand type clash: date is incompatible with int with CASE WHEN 存储过程-操作数类型冲突:smallint与uniqueidentifier不兼容 - Stored procedure - Operand type clash: smallint is incompatible with uniqueidentifier 操作数类型冲突:日期与int不兼容? - Operand type clash: date is incompatible with int? 操作数类型冲突:int与utblProgramAllotment [用户定义的表类型]不兼容 - operand type clash: int is incompatible with utblProgramAllotment[user defined table type]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM