Home > database >  RTRIM causing "the multipart identifier could not be bound"
RTRIM causing "the multipart identifier could not be bound"

Time:12-24

I feel as if the following should work. Trying to right trim and add login_name and custr_id on the same row with a ':' in between them. But im getting multipart identifiers could not be bound on everything such as l.login_name, c.custr_id, etc..

SELECT
rtrim(l.login_name) ':' 
rtrim(c.custr_id)
FROM
customer c
LEFT JOIN login l
ON l.custr_id = c.custr_id
WHERE
c.custr_id=777

CodePudding user response:

Well everyone, I'm very sorry. This makes absolutely no sense. Restarting SSMS fixed the issue... But then the issue came back. Even though it shows I still have a live connection. Restarting fixed it again.

Operator technique I suppose. Now something else for me to look into.

CodePudding user response:

it is probably failing if something is NULL. I would apply a coalesce() such as

rtrim(coalesce(l.login_name, '')) ':' 
rtrim(coalesce(c.custr_id, ''))
  • Related