简体   繁体   English

SQL-Server - 操作数类型冲突:uniqueidentifier与int不兼容

[英]SQL-Server - Operand type clash: uniqueidentifier is incompatible with int

When I am executing this code I am having this error. 当我执行此代码时,我遇到此错误。 Operand type clash: uniqueidentifier is incompatible with int . 操作数类型冲突:uniqueidentifier与int不兼容 What are the solutions to remove this error please? 请删除此错误的解决方案有哪些? Thanks 谢谢

CREATE FUNCTION [a01].[udf_isUserActive]
(@AccountID INTEGER)
    RETURNS BIT
    AS
    BEGIN
IF (EXISTS (SELECT  accountID
            FROM    [a01].[tbl_userAccounts]
            WHERE   accountID = @AccountID
                    AND isActive = 1))
    RETURN 1;

RETURN 0;
END;
GO

Most probably tbl_userAccounts has an AccountID of type UNIQUEIDENTIFIER and you are trying to compare @AccountID INTEGER with an UNIQUEIDENTIFIER . 很可能tbl_userAccountsAccountID类型为UNIQUEIDENTIFIER ,您试图将@AccountID INTEGER与UNIQUEIDENTIFIER进行比较。

Side note: you should provide the entire context: table schema and function call context. 附注:您应该提供整个上下文:表模式和函数调用上下文。 It is a big change that calling the function may also lead to performance problems as scalar functions are called per each selected row. 这是一个很大的变化,调用函数也可能导致性能问题,因为每个选定行调用标量函数。

暂无
暂无

声明:本站的技术帖子网页,遵循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 - error 'operand type clash uniqueidentifier is incompatible with int' with Union 操作数类型冲突:uniqueidentifier与查询中的int不兼容 - Operand type clash: uniqueidentifier is incompatible with int in query 操作数类型冲突:uniqueidentifier与int不兼容 - Operand type clash: uniqueidentifier is incompatible with int 操作数类型冲突:int与sqlsever 2012中的uniqueidentifier不兼容 - Operand type clash: int is incompatible with uniqueidentifier in sqlsever 2012 SQL 服务器错误“操作数类型冲突:varchar 与 int 不兼容” - SQL Server error "Operand type clash: varchar is incompatible with int " SQL 服务器“操作数类型冲突:int 与日期不兼容”错误 - SQL Server 'Operand type clash: int is incompatible with date' error 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 服务器错误操作数类型冲突:int 与日期不兼容 - SQL Server error Operand type clash: int is incompatible with date
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM