Skip to content
Advertisement

Converting NVARCHAR to INT after SUBSTRING using CHARINDEX and LEN

I am trying to join two tables using UI’s but the UI in one of the tables has ‘CLIENT_’ before it. When trying to remove the ‘CLIENT_’ from the string and then compare the UI’s I am getting the following error.

Error converting data type nvarchar to float.

When attempting to convert or cast the whole subquery to INT or FLOAT the same error occurs.

Has anyone got any ideas or know how I can code to get this working.

I would like to be able to join NAMEACCOUNTSDATA_STAGING on P.CUSTOM1 and AD.NAMENO as these are the only fields I can join these tables together with.

LATEST ATTEMPT AT MAKING THIS WORK….

Schema’s for all three tables involved:

Hope that’s what you were looking for.

Advertisement

Answer

Convert the number to a string!

Or:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement