|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 12:25 PM
Points: 7,110,
Visits: 7,184
|
|
Toreador (5/17/2011)
Koen Verbeeck (5/16/2011) And the explanation doesn't mention why inserting NULL in another string doesn't result in NULL, but in an empty space instead.
That's what got me. Surely it's a bug? select 'Vinay, ' + NULL + ', Amit' returns NULL, so I'd have thought select STUFF('Vinay, Vijay, Amit',8,5,NULL) should do the same? That's exactly my reaction. The BoL page quoted states that the last expression is inserted in the other, and I'm pretty sure that sticking a NULL in the middle of a string should produce NULL. If it doesn't, I would regard it as a bug unless there were a clear statement in BoL that this operation on NULL was unlike any other in SQL (if there is such a statement, I haven't found it). I wonder if it's affected by the CONCAT_NULL_YIELDS_NULL setting?
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:51 AM
Points: 1,085,
Visits: 1,166
|
|
Toreador (5/17/2011)
Koen Verbeeck (5/16/2011) And the explanation doesn't mention why inserting NULL in another string doesn't result in NULL, but in an empty space instead.
That's what got me. Surely it's a bug? select 'Vinay, ' + NULL + ', Amit' returns NULL, so I'd have thought select STUFF('Vinay, Vijay, Amit',8,5,NULL) should do the same?
Hi,
Few days ago, when i was playing with some strings, i found this . That time i also shocked. I feel that we all should know this. that's why i sumbit this question. i think it help us.
Thx Vinay
Keep Learning - Keep Growing !!! http://growwithsql.blogspot.in
Thanks Vinay Kumar
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 6:14 AM
Points: 592,
Visits: 1,423
|
|
Wow... that didn't work quite the way I'd expected it to! Nice question!
(And I'm really glad I checked my answer in SQL before actually answering the question!)
-Ki
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 12:25 PM
Points: 7,110,
Visits: 7,184
|
|
Danny Ocean (5/17/2011) Hi,
Few days ago, when i was playing with some strings, i found this . That time i also shocked. I feel that we all should know this. that's why i sumbit this question. i think it help us.
Thx Vinay
That's a very good reason for posting the question. Thanks, Vinay.
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 4:58 AM
Points: 1,152,
Visits: 1,457
|
|
Another ticky tack problem. Sure, I said 2, because the results were the same, just in a different order. It was the last of the two matching result sets. (No order by clause, so order doesn't matter. )
By the way, what setting in SQL Server Management Studio must I have set that required me to put semicolons at the end of each command before they would run without error?
Please don't go. The drones need you. They look up to you.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 6:23 AM
Points: 1,331,
Visits: 433
|
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Monday, April 08, 2013 8:13 AM
Points: 692,
Visits: 100
|
|
Damn it. I answered correctly, but there was 2 same answers and I choose the wrong one
Or is there some difference between those 2 answers?
1. Vinay, Anup, Amit 2. Vinay, , Amit 3. NULL 1. Vinay, Anup, Amit 3. NULL 2. Vinay, , Amit

|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 12:25 PM
Points: 7,110,
Visits: 7,184
|
|
I've submitted a connect item suggesting this behavious be changed.
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 7:43 PM
Points: 2,174,
Visits: 3,586
|
|
Tom.Thomson (5/17/2011)
I've submitted a connect item suggesting this behavious be changed.
Thank you Tom
Mohammed Moinudheen
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Monday, September 17, 2012 7:30 AM
Points: 1,038,
Visits: 679
|
|
| Good Question and nice to know about the bug in this function.
|
|
|
|