Tech Off Post

Single Post Permalink

View Thread: Good SQL Fizz Buzz
  • User profile image

    ScanIAm wrote:
    odujosh wrote:
    ScanIAm wrote:
    Sadly, I had to look up the syntax for replace and I'm assuming that you mean using the print function when you refer to messages?  Or are you talking about raiseerror.

    Hint: Requires Left, Right, LEN, and PatIndex You could also write it with Substring if you enjoy pain or are more comfi.

    I would accept Print or Select. Really knowing the differences is trivial. Seeing whether you can think through the problem is more interesting.

    'You' being sample candidate.

    I'm not sure if you changed the criteria, but once you declare the missing variables and load them up, the replacement requires 1 line of code:

    Select @NewPath = REPLACE(@OldPath, @OldNode, @NewNode)

    Am I missing something?

    REPLACE is not necessary. OldNode only occurs once. And ScanIAm: Length will always be 5. This limits the design to only in number of groups. The number of groups will always be under 10,000 closer to in the hundreds. Its not flawed the designer realizes the limitation.

    Though you do show why fixed length is a benifit.