July 11, 2010 at 8:15 am
Comments posted to this topic are about the item REPLACE() and NULL
-----
a haiku...
NULL is not zero
NULL is not an empty string
NULL is the unknown
July 11, 2010 at 8:16 am
July 11, 2010 at 4:33 pm
Nice question - thanks.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 11, 2010 at 10:47 pm
July 11, 2010 at 11:37 pm
thnx nice one 🙂
SELECT REPLACE('Hello world',NULL, 'zzz' );
as suggested by you... even this returns the same output
July 11, 2010 at 11:54 pm
[p]I learnt new thing today. Thanks Ronmoses.[/p]
KSB
-----------------------------
Thousands of candles can be lit from a single candle, and the life of the candle will not be shortened. Knowledge and happiness never decreases by being shared.” - Buddha
July 12, 2010 at 1:23 am
[font="Verdana"]Goodish! simple and informative!
[/font]
July 12, 2010 at 3:11 am
Good question. i like this function. Have used it
July 12, 2010 at 5:20 am
A simple question, but a usefull one nonetheless, especially if you use the function with variables as input parameters.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 12, 2010 at 7:53 am
This is one of those things that can be a real gotcha if you don't know about it, and put in code to handle it ahead of time. Thanks.
July 12, 2010 at 8:05 am
Nice question.
July 12, 2010 at 9:17 am
Anyone got any ideas why this function was made to work this way? Makes no sense to me.
July 12, 2010 at 9:53 am
kevin.l.williams (7/12/2010)
Anyone got any ideas why this function was made to work this way? Makes no sense to me.
I cannot answer that authoritatively, but consider that it would make no sense to try to replace part of a string with NULL either, so perhaps the decision was made to check the types of all three parameters first before doing the matching.
--
edit: fix typo
July 12, 2010 at 10:07 am
Good question.
Also, thanks John Arnott for the explanation. It makes sense.
July 12, 2010 at 10:24 am
KevinC. (7/12/2010)
It makes sense.
Really? Would it have been too difficult to return the string unmodified if there was a NULL detected? In the way it is now, a small bug can be disastrous, potentially wiping out critical data.
Viewing 15 posts - 1 through 15 (of 28 total)
You must be logged in to reply to this topic. Login to reply