I need to join two tables on a common field. However, the data in one table gets modified - '(data)' gets appended.
So, I need my query two join on two fields, but trim one of them up to '('.
My attempt is:
SELECT wa_batchinfo.clstatusdesc, udfvlst.uddesc
FROM udfvlst
INNER JOIN wa_batchinfo
ON udfvlst.uddesc = LEFT(wa_batchinfo.clstatusdesc, CHARINDEX('(', wa_batchinfo.clstatusdesc)-1)
but I get:
Msg 536, Level 16, State 5, Line 2
Invalid length parameter passed to the SUBSTRING function.
any help appreciated.
So, I need my query two join on two fields, but trim one of them up to '('.
My attempt is:
SELECT wa_batchinfo.clstatusdesc, udfvlst.uddesc
FROM udfvlst
INNER JOIN wa_batchinfo
ON udfvlst.uddesc = LEFT(wa_batchinfo.clstatusdesc, CHARINDEX('(', wa_batchinfo.clstatusdesc)-1)
but I get:
Msg 536, Level 16, State 5, Line 2
Invalid length parameter passed to the SUBSTRING function.
any help appreciated.