April 21, 2011 at 7:01 am
David Burrows (4/21/2011)
Jeff Moden (4/20/2011)
If we don't know the length, then we can force the max length for positive BIGINTs and simply remove all spaces afterwards.Also if you append the separator to the cast instead of prefixing, you don't need the stuff 😛
Great idea! It also converts the totally NULL lines to empty strings which may be a benefit for additional processing.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 21, 2011 at 7:04 am
David Burrows (4/21/2011)
ChrisM@home (4/21/2011)
Evolution in practice - don't you just love it 😀It is darn near impossible to improve on Jeff's solutions, so must make the most of it while I can 😀
Thanks guys. :blush: Wish I could take credit for this one but Jason's suggestion is what brought this one out. 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.
April 21, 2011 at 7:07 am
ChrisM@home (4/21/2011)
David Burrows (4/21/2011)
Jeff Moden (4/20/2011)
If we don't know the length, then we can force the max length for positive BIGINTs and simply remove all spaces afterwards.Also if you append the separator to the cast instead of prefixing, you don't need the stuff 😛
Evolution in practice - don't you just love it 😀
That's why I love this place. 🙂 This particular type of problem is more common that I care to admit and I've seen all manner of code to solve it but nothing this simple. Jason's ephiphany was spot on.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 21, 2011 at 7:12 am
Jeff Moden (4/21/2011)
ChrisM@home (4/21/2011)
David Burrows (4/21/2011)
Jeff Moden (4/20/2011)
If we don't know the length, then we can force the max length for positive BIGINTs and simply remove all spaces afterwards.Also if you append the separator to the cast instead of prefixing, you don't need the stuff 😛
Evolution in practice - don't you just love it 😀
That's why I love this place. 🙂 This particular type of problem is more common that I care to admit and I've seen all manner of code to solve it but nothing this simple. Jason's ephiphany was spot on.
Stop it Jeff, you're making me blush.. LOL
Nothing remarkable here.
Sometimes it's just best to take a step back. Just like they say "If you can't see the forest for the trees, cut the darned things down!"
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgApril 21, 2011 at 9:11 am
Good job Jason! (Heck, I really did like my solution, but this is so much better.)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply