简体   繁体   English

SQL Server-与工会的错误“操作数类型冲突uniqueidentifier与int不兼容”

[英]SQL Server - error 'operand type clash uniqueidentifier is incompatible with int' with Union

I am trying to union 2 tables, one of table has required column type as 'Int' and another table has column type as 'uniqueidentifier'.. because of this when I try to do union of 2 tables I get this error: 我正在尝试合并2个表,其中一个表的列类型要求为'Int',而另一个表的列类型为'uniqueidentifier'..因此,当我尝试进行2个表的合并时,出现此错误:

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

Is there any way I can overcome this issue? 有什么办法可以解决这个问题?

You could skip both column from column list or add NULL : 您可以从列列表中跳过两列,也可以添加NULL

SELECT col1, col2, col3, col_GUID, NULL as col_INT FROM tab1
UNION ALL
SELECT col1, col2, col3, NULL AS col_GUID, col_INT FROM tab2

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

相关问题 SQL Server:返回的UniqueIdentifier,操作数类型冲突:uniqueidentifier与int不兼容 - SQL Server: Returning UniqueIdentifier, Operand type clash: uniqueidentifier is incompatible with int SQL-Server - 操作数类型冲突:uniqueidentifier与int不兼容 - SQL-Server - Operand type clash: uniqueidentifier is incompatible with int 操作数类型冲突:uniqueidentifier与查询中的int不兼容 - Operand type clash: uniqueidentifier is incompatible with int in query 操作数类型冲突:uniqueidentifier与int不兼容 - Operand type clash: uniqueidentifier is incompatible with int SQL 服务器错误“操作数类型冲突:varchar 与 int 不兼容” - SQL Server error "Operand type clash: varchar is incompatible with int " SQL 服务器错误操作数类型冲突:int 与日期不兼容 - SQL Server error Operand type clash: int is incompatible with date 操作数类型冲突:int与sqlsever 2012中的uniqueidentifier不兼容 - Operand type clash: int is incompatible with uniqueidentifier in sqlsever 2012 SQL Server 2012(触发器)操作数类型冲突:int与日期不兼容 - SQL Server 2012 (triggers) Operand type clash: int is incompatible with date SQL Server Operand类型冲突:日期与int不兼容 - Sql Server Operand type clash: date is incompatible with int SQL错误IS操作数类型冲突:int与日期不兼容 - SQL ERROR IS Operand type clash: int is incompatible with date
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM