[英]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_userAccounts
的AccountID
类型为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.