Update Statement

  • Hi everybody!

    I have a table with following values

    Name

    ----

    Bill

    Jim

    Anton

    I would like to create an update statement which concatenates to the existing value a number

    So after I run the update statement i will have:

    Name

    ----

    Bill 3213

    Jim 3213

    Anton 3213

    Is there a way to do this without using a cursor, that will take each record and concatentes the number? Just a simple update statement??

    Thanks,

    Duruguru

  • UPDATE tblName SET [Name] = [Name] + ' 3213'

    Thsi si based on your example, if this is not what is being done please specify.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • I tryed the same statement and I got this error when I tryed in QA before posting this question

    String or binary data would be truncated.

    The statement has been terminated.

    So I got scared :))

    I had to add the rtim function

    Thank you a lot!

  • Ok so I guess rtrim got it (must be a char field). The reason you would ever get "String or binary data would be truncated" would be if the field is not wide enough for the new data.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 4 posts - 1 through 3 (of 3 total)

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