bug_x

导航

 

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')

  

posted on 2021-10-08 10:24  bug_x  阅读(305)  评论(0编辑  收藏  举报