sql server将字符串转换为 uniqueidentifier 时失败

sql server查询中出现 将字符串转换为 uniqueidentifier 时失败异常

原因为id设置为uniqueidentifier 字段,在where查询时需要做转换cast(id as varchar(36)),例如

select * from test where cast(id as varchar(36)) in('2946a572-7dbf-4ab8-a9d2-0374797eac7f','46bc350c-ff43-4b53-98f4-62b542f16ba8')

原文地址:https://www.cnblogs.com/chyg/p/5404591.html