SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot daveporter's Avatar
    Join Date
    Mar 2002
    Location
    Perth, Western Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking mySQL Uppercase fields

    Hi All,

    Can a mySQL varchar field be forced to have it's content automatically uppercase ?

    An attribute maybe...

    Can't find any details...

    regards Dave P

  2. #2
    SitePoint Enthusiast kennyisnotdead's Avatar
    Join Date
    Apr 2002
    Location
    Massachusetts
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not to sure about setting it to all uppercase. but you can write script that will make the content upper case before it is entered into the table.

  3. #3
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yup i'm also not sure about setting it as an attribute but you could always use UPPER(col_name) in your SELECT statements to extract them in uppercase...

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From the mySQL manual, http://www.mysql.com/documentation/m...ring_functions

    - - - - - - - - - - - - - - -

    LCASE(str)
    LOWER(str)
    Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1):

    mysql> SELECT LCASE('QUADRATICALLY');
    -> 'quadratically'

    This function is multi-byte safe. UCASE(str)
    UPPER(str)
    Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1):

    mysql> SELECT UCASE('Hej');
    -> 'HEJ'

    This function is multi-byte safe.
    - - - - - - - - - - - - - - -


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
  •