进行选择计数时,我无法转换为唯一标识符。
select count (rs.column)
from table1 sw
join table2 sl
on sl.column = sw.column
join table3 sps
on sps.column = sw.column
join table4 ps
on ps.column = sps.column
join table5 ec
on ec.column = ps.column
join db.table1 rs
on rs.column = sw.column
where ec.column in
(
)
答案 0 :(得分:1)
您的一个联接将UNIQUEIDENTIFIER
列连接到非UNIQUEIDENTIFIER
列,并且该列(非唯一标识符)包含一些无法转换为UNIQUEIDENTIFIER
的数据,或者where子句尝试将一个UNIQUEIDENTIFIER
列与您的in列表中的值进行比较,该值无法转换为UNIQUEIDENTIFIER
例如:
select * from
(select newid() as a) a
inner join (select 'x' as b) b
on a.a = b.b
or
select * from
(select newid() as a) a
where
a.a in ('x','y')
消息8169的16级状态2线1 从字符串转换为uniqueidentifier时转换失败。
https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=5ce0d5a3ad87b481a85a74e73495c061