I am trying to set this col but I get an error:
FirstName + (CASE WHEN LEN(FirstName + LastName) > 0 THEN ' ' ELSE '') + LastName
From stackoverflow
-
FirstName + (CASE WHEN LEN(FirstName + LastName) > 0 THEN ' ' ELSE '' end) + LastNamemissing the end
Wahid Bitar : But what if last name length was 0 ?cmsjr : I was just addressing the OP's syntax problem, not his approach. -
You should close CASE with END and also, to my opinion, the following value will be better:
FirstName + (CASE WHEN LEN(FirstName) > 0 AND LEN(LastName) > 0 THEN ' ' ELSE '' END) + LastNameShimmy : Good point about counting the chars and sum them vs. concatenating strings which cost more performance.
0 comments:
Post a Comment