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
ThanksOriginally 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|||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|||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
No comments:
Post a Comment