Operand type clash: uniqueidentifier is incompatible with float
I have the foll开发者_开发百科owing SQL statement:
select pc.*,au.UserName from ProspectsInCampaigns pc
inner join prospects p on p.id=pc.prospectid
inner join aspnet_Users au on STR(au.UserId)=pc.updatedby
WHERE p.id=1225982
The problem is, that the updatedby field in ProspectsInCampaigns contains either an empty string, or a string that is indeed a UUID. In the above case I get the error:
Operand type clash: uniqueidentifier is incompatible with float
How can I prevent that from happening?
Don't compare the UUID
to a float
. Why are you doing that anyways?
You can consult this handy chart to know what conversions are allowed. If you can't convert two datatypes to each other, you can't compare them directly.
Hypothetically you could convert both to a string type like varchar
but since it's impossible to have a UUID
match anything that can be a float
there's no point.
Edit:
More specifically, it looks like Userid
is a UUID
and the STR()
function is specifically for converting float
data to a string datatype.
Why are you trying to convert au.UserID anyway? If you have a UUID, compare it to the other UUID directly.
精彩评论