[英]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.