Results 1 to 8 of 8

Thread: text formating

  1. #1
    Join Date
    Mar 2004
    Posts
    162

    Unanswered: text formating

    i have this:
    \\FIL\Internal\BuisnessArea\*.*
    \\FIL\Internal\BuisnessArea\
    \\FIL\Internal\BuisnessArea\*.qvw
    \\FIL\Internal\BuisnessArea\tempfileDB.mdb
    \\FIL\Internal\Public Area\*.*
    \\FIL\Internal\Public Area\
    \\FIL\Internal\Public Area\*.xls
    \\FIL\Internal\Public Area\acro*.doc
    \\FIL\Internal\Public Area\economi\*.xls
    \\FIL\Internal\Public Area\economi\Group01\FileToSave*.xls
    \\FIL\Internal\Public Area\economi\Group01\Unit01\FileToSave*.xls

    And i want to strip away whatever is after the last '\' so the output should look like this
    \\FIL\Internal\BuisnessArea\
    \\FIL\Internal\BuisnessArea\
    \\FIL\Internal\BuisnessArea\
    \\FIL\Internal\BuisnessArea\
    \\FIL\Internal\Public Area\
    \\FIL\Internal\Public Area\
    \\FIL\Internal\Public Area\
    \\FIL\Internal\Public Area\
    \\FIL\Internal\Public Area\economi\
    \\FIL\Internal\Public Area\economi\Group01\
    \\FIL\Internal\Public Area\economi\Group01\unit01

    datatype = varchar (500)

    thx alot in advance

    //Mr

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    left(foo,len(foo)-charindex('\',reverse(foo))+1)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2004
    Posts
    162
    this forum is amazing

    thx alot

  4. #4
    Join Date
    Nov 2006
    Location
    UK
    Posts
    46
    Hi
    You did not provided structure of the table so I will operate on one of example strings.
    You can replace '\\FIL\Internal\BuisnessArea\tempfileDB.mdb' by your column name.

    Code:
    select left('\\FIL\Internal\BuisnessArea\tempfileDB.mdb', len('\\FIL\Internal\BuisnessArea\tempfileDB.mdb') - charindex('\', reverse('\\FIL\Internal\BuisnessArea\tempfileDB.mdb')) + 1)
    Regards
    Kris Zywczyk

  5. #5
    Join Date
    Nov 2006
    Location
    UK
    Posts
    46
    r937 was first
    Regards
    Kris Zywczyk

  6. #6
    Join Date
    Mar 2004
    Posts
    162
    thx anyway

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    anyway????
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Mar 2004
    Posts
    162
    since english not my first language maybe that was wrong word...

    just thx for the 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
  •