Hi there,
Is there any setting in SQL that can disable this silly logic.
For example, in a number cleaning query I want to combine the Code and the Number
The problem is that I either the code or the number is null, I lose the number:
update tbl
set Teleh = CodeH + TeleH
I know that I can split this and check if one is null, both null, both non-null but i am sure there must be an easier way such as Accesses & operator
The way that I am using now does this, but i'm not sure if this is the best approach
update tbl
set Teleh = isnull(Codeh,'') + isnull(Teleh,'')
The problem with this is that the result is not stored as null, but as '' length 0The problem with this is that the result is not stored as null, but as '' length 0but that's exactly what you wanted!!
or are you saying that if they are both null then you want the result null?
in that case (pun intended),update tbl
set Teleh = case when CodeH is null
and TeleH is null
then null
else coalesce(CodeH,'')
+coalesce(TeleH,'')
end|||Sorry
Often, the entire number is stored in CodeH and Teleh is empty
So if a update it to Codeh + Teleh, I loose the correct number in Codeh
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment