Update a column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ton5938
    New Member
    • Aug 2006
    • 1

    Update a column

    I have a table that has a column that contains an employee number in the form xxx-xxxxx i want to change the data in this column to the form xxxxxxxx.

    How???
  • vssp
    Contributor
    • Jul 2006
    • 268

    #2
    Using update query and using "str_replac e" function to remove the -

    Comment

    • Seun Ojo
      New Member
      • Aug 2006
      • 14

      #3
      Lets say d table name is Tabl n d col to change is Colm

      try any of ds:

      Update Tabl
      set Colm = SELECT REPLACE(Colm,'-','')
      GO

      Or

      Update Tabl
      set Colm = REPLACE(Colm,'-','')
      GO


      Op it works....Be good man!

      Comment

      • Seun Ojo
        New Member
        • Aug 2006
        • 14

        #4
        Note dat i didnt put d where clause....its no mistake....its based on d assumption dat u intend 2 change ol d records in d table or dat ol records r to be affected...
        u can put d where condition if mi assumption is wrong....
        dat way it will be something like ds for d second solution:

        Update Tabl
        set Colm = REPLACE(Colm,'-','')
        {where id = (specify criteria expression)}
        GO

        d curly signifies dat u can totally replace ds with ur own where clause....
        op u found dat useful?

        Comment

        Working...