db2 script needed to count and delete the data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhilash malyala
    New Member
    • Mar 2008
    • 1

    db2 script needed to count and delete the data

    Hi Folks,

    I need a script to count and delete the lower and mixed case data in one particular field from a table.

    example: table name is employee and field name is 'NAME' and data in the NAME
    field contains lower case and mixed case.

    Thanks and Regards
    Abhi
  • Intakhab
    New Member
    • Jun 2007
    • 2

    #2
    Originally posted by abhilash malyala
    Hi Folks,

    I need a script to count and delete the lower and mixed case data in one particular field from a table.

    example: table name is employee and field name is 'NAME' and data in the NAME
    field contains lower case and mixed case.

    Thanks and Regards
    Abhi

    hi,
    I think if i am not wrong then
    Ur Query will be :
    Delete employee where Upper(Name)='SM ITH'
    or
    Delete employee where lower(Name)='sm ith'

    Thanks
    Intakhab Alam

    Comment

    • sakumar9
      Recognized Expert New Member
      • Jan 2008
      • 127

      #3
      Yes, you are right. You can use UCASE and LCASE functions in such cases.

      Comment

      • docdiesel
        Recognized Expert Contributor
        • Aug 2007
        • 297

        #4
        Hi,

        to count the lines where the name is not stored in lower case (means is upper or mixed case) you could use the following query:

        Code:
        SELECT
          count(NAME)
        FROM
          employee
        WHERE
          NOT lcase(NAME) = NAME ;
        Got your sql script ready? What does it look like?

        Regards,

        Bernd

        Comment

        Working...