Concatenation Syntax Question

  • I have 1.

    I want 3.

    I don't know 2. How do I drop the '123 ' from each employee's name

    --1--

    '123 Bib Fortuna'

    '123 Scott Summers'

    '123 Jenna Maroney'

    --2--

    UPDATEEmployees

    SET

    WHEREName LIKE '123%'

    --3--

    'Bib Fortuna'

    'Scott Summers'

    'Jenna Maroney'

  • Lawrence, you can make use of REPLACE function to perform the operation, like this:

    DECLARE @Table TABLE

    (

    Name VARCHAR(20)

    )

    INSERT INTO @Table (Name)

    SELECT '123 Bib Fortuna' UNION ALL

    SELECT '123 Scott Summers' UNION ALL

    SELECT '123 Jenna Maroney'

    SELECT REPLACE( Name , '123 ' , '') AS [123_REMOVED_NAMES]

    FROM @Table

    Hope this helps 🙂

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

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