data manipulation query

Last post 07-26-2008, 2:12 PM by Phil Factor. 1 replies.
Sort Posts: Previous Next
  •  07-25-2008, 10:20 AM Post number 64338

    data manipulation query

    Hi,
    I'm trying to alter some data in a column, most of the data contains just 4 characters, such as '1234', but the odd row contains '5678-09'. The only consistent character is the '-' but I want to update all rows to only contain the first 4 numerical characters.

    What would be the best way to achieve this within t-SQL?

    Any help will be greatly appreciated.

    Mosser212

  •  07-26-2008, 2:12 PM Post number 64576 in reply to post number 64338

    Re: data manipulation query

    Update MyTable set MyColumn=left(MyColumn,4)
    where MyColumn like '%-%'
    -- am I missing the subtelty of this question?
View as RSS news feed in XML