Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2003
    Posts
    35

    Unanswered: Enforcing Upper Case

    Hi,

    Is there a way of ensuring that each first letter for a column is in Upper Case. E.g. customer first and last names will be converted in upper case when entered in lower. I know in access this can be done in the table design. I have looked in books online and it show only upper or lower in the transformations tab.

    Many thanks,

    Mark

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You could use a trigger that changes the value after it is entered, or you could restrict entry by putting a constraint on that requires:
    ASCII([YourString]) = ASCII(UPPER([YourString]))

    blindman

  3. #3
    Join Date
    Sep 2003
    Posts
    35
    Hi,

    Would that mean that the first letter of the string would be in upper case or do i need to add something else. Many thanks




    Originally posted by blindman
    You could use a trigger that changes the value after it is entered, or you could restrict entry by putting a constraint on that requires:
    ASCII([YourString]) = ASCII(UPPER([YourString]))

    blindman

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    ASCII accepts a multi-character string, but only operates on the first character.

    blindman

  5. #5
    Join Date
    Sep 2003
    Posts
    35
    Being new to sql server, could you give me an example. Where you have 'your string' in brackets what does this refer to. I need to make a constraint on the whole column. An imput mask in Access talk.
    Thanks


    Thanks



    Originally posted by blindman
    ASCII accepts a multi-character string, but only operates on the first character.

    blindman

  6. #6
    Join Date
    Oct 2003
    Posts
    8
    You could also have a trigger on insert:

    Update [table]
    set [columnname] = UPPER(Left([columnname],1) + Right([columnname], Len(columnname) - 1))
    where Left([columnname],1) <> UPPER(Left([columnname],1)

  7. #7
    Join Date
    Sep 2003
    Posts
    522
    i think this task better fits your front-end, since, if i undertsand it correctly, it's a data entry form you're describing. i don't think burdening your db with this trivial thing is a good idea.

  8. #8
    Join Date
    Sep 2003
    Posts
    35
    Yes, I think you are right with the front end issue.

    Many thanks,

    Mark



    Originally posted by ms_sql_dba
    i think this task better fits your front-end, since, if i undertsand it correctly, it's a data entry form you're describing. i don't think burdening your db with this trivial thing is a good idea.

Posting Permissions

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