Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2002
    Posts
    59

    Unanswered: What is start with and connect by prior

    what can I use in Ms sql instead of Lpad, start with and connect by prior.
    Where can I find information about matches of Oracle functions in Ms sql Server?

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Can you describe the functionality of each ?

  3. #3
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    if I understand your question...

    http://www.adp-gmbh.ch/ora/sql/connect_by.html

    I am not aware of any statments in T-SQL that would give you similar results.
    Paul Young
    (Knowledge is power! Get some!)

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    LPAD is a function to pad a string on the left with another character string (doesn't have to be a single character, either) repeated often enough to create the desired length

    in microsoft sql/server, look at the REPLICATE function, maybe combined with LENGTH and SUBSTRING (i'd have to see your exact requirement)

    as for START WITH and CONNECT BY, microsoft sql/server just flat out cannot do that

    rnealejr, you may want to bookmark Oracle9i Database Online Documentation, Release 2 (9.2) (free registration required) if you want to look up oracle syntax

    rudy

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    okay, replying to my own post, maybe data shaping can do it, but i'm not sure...

    do a search on http://4guysfromrolla.com/, they had an article or two on it

    oops, just to be sure, i did that, and guess what, the search on their site brings back 0 results for "data shaping"

    so i tried google, and guess what the number 1 hit is? Data Shaping

    go figure


    rudy

  6. #6
    Join Date
    Feb 2002
    Posts
    2,232
    To duplicate the lpad functionality (where what you are padding is a constant character) you can use the stuff function with replicate.

    For example:

    select stuff('abcdef',1,0,replicate(' ', 4))

    will insert 4 spaces before the string.

  7. #7
    Join Date
    Feb 2002
    Posts
    2,232
    The only problem with using data shaping is that it is not supported within sql server - only through ado. So you would have to write an application (or com component) to obtain this functionality. I found an article with a good explanation of the start with / connect by:

    article

  8. #8
    Join Date
    Nov 2002
    Posts
    59

    Talking thanx

    I solved the problem, I'm appreciate everybody, thanx for help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •