Professional Web Applications Themes

UCASE(ing) the first letters - Microsoft SQL / MS SQL Server

You will have to write a user function to do the work and call the function from your Select. "Jason Davis" <com> wrote in message news:phx.gbl... ...

  1. #1

    Default Re: UCASE(ing) the first letters

    You will have to write a user function to do the work and call the function
    from your Select.

    "Jason Davis" <com> wrote in message
    news:phx.gbl... 


    The Guest

  2. #2

    Default Re: UCASE(ing) the first letters

    K, but what can be that function?

    "The Margolins" <net> wrote in message
    news:DWx%a.85011$srv.hcvlny.cv.net... 
    function 
    >
    >[/ref]


    Jason Guest

  3. #3

    Default Re: UCASE(ing) the first letters

    See http://vyaskn.tripod.com/code.htm#propercase

    Net

    Please reply only to the newsgroups.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    You assume all risk for your use.
    Copyright SQLDev.Net 1991-2003 All rights reserved.

    "The Margolins" <net> wrote in message
    news:IPy%a.85405$srv.hcvlny.cv.net... 
    with 
    > > function 
    > >
    > >[/ref]
    >
    >[/ref]


    Gert Guest

  4. #4

    Default Re: UCASE(ing) the first letters

    "Jason Davis" <com> wrote in message
    news:%phx.gbl... 

    Here's one I prepared earlier. Watch out for the select result = result +
    .... line. I've seen it mentioned that the success of this may depend on the
    query plan, but it works on our dual processor server so parallellism
    doesn't seem to be an issue:

    ALTER function dbo.fnProperCase(str varchar(8000))
    returns varchar(8000)
    as
    begin
    declare result varchar(8000) set result = ''
    select result = result + stuff(s.element, 1, 1, upper(left(s.element,
    1))) + ' '
    from dbo.fnSplit(str, ' ') s

    return result
    end

    It uses another function, fnSplit, which splits a string into a table of
    values based on the split character. You need a table of integers to make it
    work (exploder, holds the values 1 through... 32767 or something. It's a
    modified version of a function I've seen posted here before:

    ALTER function fnSplit(str varchar(7000), dl char(1) = ',')
    returns table
    as
    return (
    select substring(dl + str + dl, val + 1, charindex(dl, dl + str
    + dl, val + 1) - val - 1) as element
    from Exploder
    where val < len(dl + str + dl)
    and substring(dl + str + dl, val, 1) = dl
    )


    Donald Guest

Similar Threads

  1. Creating an exception list to a UCase function rule
    By Dan in forum Macromedia ColdFusion
    Replies: 3
    Last Post: September 7th, 04:00 PM
  2. UCase and German characters
    By netuser in forum Macromedia ColdFusion
    Replies: 4
    Last Post: May 25th, 05:50 AM
  3. every combination of letters
    By roger in forum PERL Miscellaneous
    Replies: 25
    Last Post: October 14th, 09:29 PM
  4. Capital Letters
    By Miguel Orrego in forum ASP
    Replies: 7
    Last Post: August 20th, 02:27 PM
  5. outline of letters
    By racein webforumsuser@macromedia.com in forum Macromedia Fireworks
    Replies: 1
    Last Post: July 19th, 09:51 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139