Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    10

    Unanswered: concatenate problem

    Hi All,

    I am facing problem when i try to concatenate two columns. I have text in one column and numeric data in other field, and in want to update field with text datatype and wants to put '-field2'(field with numeic data) as suffix in text data field.

    Result should be "field1-field2"

    Any help will be appericiated

    Thanks
    Thanks in advance
    Devinder

  2. #2
    Join Date
    Oct 2003
    Location
    Arizona
    Posts
    3

    Re: concatenate problem

    Originally posted by Devinder Gera
    Hi All,

    I am facing problem when i try to concatenate two columns. I have text in one column and numeric data in other field, and in want to update field with text datatype and wants to put '-field2'(field with numeic data) as suffix in text data field.

    Result should be "field1-field2"

    Any help will be appericiated

    Thanks
    If I read that right you want:

    Select field1 + convert(varchar, field2)

    You can use that in an INSERT or UPDATE statement.

    HTH, Saint

  3. #3
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    10

    Re: concatenate problem

    If I read that right you want:

    Select field1 + convert(varchar, field2)

    You can use that in an INSERT or UPDATE statement.

    HTH, Saint [/SIZE][/QUOTE]

    Hi Saint,

    Thanks for your reply. I tried this but it works fine in select statement but in update it gives different results.

    Following is result in select statement and thats what i want after update
    07535494187886-1
    07535494187886-2
    07535494187886-3
    07535494187886-4
    30834281804606-1
    09462976809022-1
    09462976809022-2
    37882735916006-1

    But actually after update i am getting following result

    07535494187886-1-1-1-1-1-1-1-1
    07535494187886-2-2-2-2-2-2-2
    07535494187886-3-3-3-3-3-3
    07535494187886-4-4-4-4-4
    30834281804606-1-1-1-1
    09462976809022-1-1-1
    09462976809022-2-2
    37882735916006-1


    Any idea why its so.

    Thanks
    Thanks in advance
    Devinder

  4. #4
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    10

    Re: concatenate problem

    Originally posted by Devinder Gera
    If I read that right you want:

    Select field1 + convert(varchar, field2)

    You can use that in an INSERT or UPDATE statement.

    HTH, Saint
    Hi Saint,

    Thanks for your reply. I tried this but it works fine in select statement but in update it gives different results.

    Following is result in select statement and thats what i want after update
    07535494187886-1
    07535494187886-2
    07535494187886-3
    07535494187886-4
    30834281804606-1
    09462976809022-1
    09462976809022-2
    37882735916006-1

    But actually after update i am getting following result

    07535494187886-1-1-1-1-1-1-1-1
    07535494187886-2-2-2-2-2-2-2
    07535494187886-3-3-3-3-3-3
    07535494187886-4-4-4-4-4
    30834281804606-1-1-1-1
    09462976809022-1-1-1
    09462976809022-2-2
    37882735916006-1


    Any idea why its so.

    Thanks [/SIZE][/QUOTE]


    No worries guys it started working. I was just updating at wrong time. I changed the location of update now its working fantastic

    Thanks a million Saint
    Thanks in advance
    Devinder

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •