How do I capitalise the first character?

  • Hi,

    in our database we store customer name's, is there a way for me to automatically update the firstname and surname columns in the db so that the inital character is in upper case where it has been entered in lowercase?

    thanks

    Arif

  • try this code out

    DECLARE @name VARCHAR(100)

    SET @name = 'firstname'

    SELECT upper(LEFT(@name,1)) + lower(RIGHT(@name,LEN(@name) -1))

    Though you have to be really careful with automaticaly just upper casing the first character of names, as this rule does not apply to a lot of common last names eg, McDonald and van Gough

    I have seen people want to do this and quite often you end up with worse data than you started with.

Viewing 2 posts - 1 through 1 (of 1 total)

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