我想将varchar转换为唯一标识符,以将其连接到另一个表。
是varchar60
select b.ServiceName,
a.ServiceDetailsID,
c.Description,sum(a.quantity * a.unitcost) as Amount
from cashexpenses a
inner join
ServiceDetails b
on a.ServiceDetailsID = b.ServiceDetailsID
left join CashExpensesMaint c
on convert( uniqueidentifier,a.Description) = c.CemID
where a.ServiceDetailsID in
(select ServiceDetailsID
from ServiceDetails
where MarginAnalysisID =@marginalanalysisid)
group by a.ServiceDetailsID,c.Description, b.ServiceName