I want to have a checksum of the joined rows values of a table. So when i try this query, i receive the error:
Msg 8152, Level 16, State 10, Line 1, String or binary data would be truncated
SELECT TOP 10000 A.AR_Ref,
(SELECT HASHBYTES('md5',convert(varbinary(max),
(SELECT [AR_Ref],[AC_Categorie],[AC_PrixVen],[AC_Coef],[AC_PrixTTC],
[AC_Arrondi],[AC_QteMont],[EG_Champ],[AC_PrixDev],
[AC_Devise],[CT_Num],[AC_Remise],[AC_Calcul],[AC_TypeRem],
[AC_RefClient],[AC_CoefNouv],[AC_PrixVenNouv],
[AC_PrixDevNouv],[AC_RemiseNouv],[AC_DateApplication]
FROM F_ARTCLIENT AC
WHERE AC.AR_Ref = A.AR_Ref AND AC_Categorie BETWEEN 1 AND 14
FOR XML AUTO)))) AS cscli
FROM F_ARTICLE A
EDIT: I could resolve my probleme by using a special function (link provided by Giorgos Betsos in the comments)