Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

STUFF Function Expand / Collapse
Author
Message
Posted Monday, May 16, 2011 11:18 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, February 6, 2014 4:15 AM
Points: 1,242, Visits: 1,546
Comments posted to this topic are about the item STUFF Function



Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
www.GrowWithSql.com

Post #1109961
Posted Monday, May 16, 2011 11:33 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:29 AM
Points: 13,570, Visits: 10,448
Euh... wut?
Is it me and I'm going blind, but aren't the first and the second answer exactly the same?
The second and the third resultset are just swapped around (and why would you do that?)

Why put the third resultset before the second resultset in 3 of the 4 answers?

And the explanation doesn't mention why inserting NULL in another string doesn't result in NULL, but in an empty space instead.

But thanks for the effort




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1109967
Posted Tuesday, May 17, 2011 12:10 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Sunday, August 3, 2014 10:04 PM
Points: 2,953, Visits: 437
Thanks for the question. interesting to know the null is treated differently in the function.

In regards to answer A and B being the same, I think it's because of copy and paste and forgetting to swap the numbering. I decided to go for the order as it appears and got it right



Urbis, an urban transformation company
Post #1109986
Posted Tuesday, May 17, 2011 12:31 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, July 14, 2014 1:31 AM
Points: 1,002, Visits: 1,046
Easy question ,
Srikant
Post #1109995
Posted Tuesday, May 17, 2011 1:14 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 12:47 AM
Points: 2,496, Visits: 2,377
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.

I am curious: bol does not mention the case the last parameter is NULL. Maybe a BUG?
Post #1110015
Posted Tuesday, May 17, 2011 2:16 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 9:11 PM
Points: 2,270, Visits: 3,785
Thanks for the question

Mohammed Moinudheen
Post #1110030
Posted Tuesday, May 17, 2011 2:51 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, July 4, 2014 9:03 AM
Points: 1,415, Visits: 796
... made easier by the strange set of answers.
Post #1110035
Posted Tuesday, May 17, 2011 3:43 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 9:46 AM
Points: 1,737, Visits: 6,338
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?
Post #1110047
Posted Tuesday, May 17, 2011 3:48 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:29 AM
Points: 13,570, Visits: 10,448
Carlo Romagnano (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.

I am curious: bol does not mention the case the last parameter is NULL. Maybe a BUG?


It might be
Or just some lazy documentation writers at BOL




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1110050
Posted Tuesday, May 17, 2011 4:14 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, August 19, 2014 10:20 AM
Points: 558, Visits: 1,471
Koen Verbeeck (5/16/2011)
Euh... wut?
Is it me and I'm going blind, but aren't the first and the second answer exactly the same?
The second and the third resultset are just swapped around (and why would you do that?)

Why put the third resultset before the second resultset in 3 of the 4 answers?

And the explanation doesn't mention why inserting NULL in another string doesn't result in NULL, but in an empty space instead.

But thanks for the effort


My thoughts exactly. I just went for the answers that were in the correct order.
Post #1110056
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse