Auto-Capitalise the First Characters of Name Fields....

  • Is there a simple way to to automatically set the first characters of any given fields to upper case?

    e.g. Two fields: First Name = joe, Last Name = bloggs is changed to Joe and Bloggs.

    I know i could write some SQL code to go through the databases and do this, i was just interested in knowing whether SQL Server 2k5 had some kind of settings to do it automatically? i know its a long shot...:P

  • No setting (in either 2005 or 2008) 🙂 You will have to write t-sql for this.

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Ok Thanks 🙂 Im lazy so i just used:

    UPDATE Contacts

    SET LastName = UPPER(LEFT(LastName, 1)) + LOWER(SUBSTRING(LastName, 2, LEN(LastName)))

    UPDATE Contacts

    SET FirstName = UPPER(LEFT(FirstName, 1)) + LOWER(SUBSTRING(FirstName, 2, LEN(FirstName)))

    😀

  • OK, but beware of last names like O'Higgins and McDonald and van Gogh and first names like Anne Marie and Jean-Christophe.

    John

  • Aye i did think of that, to be honest, its not a BIG deal to even have the first letter capitalised. But when i get a bit of time later ill sort it. Thanks 🙂

  • I usually stay away from doing this. There is no way to be 100%. People are sensitive about their names.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply