error:将字符串转换为 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')

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM