Home All Groups Group Topic Archive Search About

Merging 2 varchar columns into 1

Author
22 Sep 2005 4:55 PM
Drew
We have a small application that holds text data for a report.  Currently it
looks like this,

RegNo - ID of the person
MostImportant
SecondImportant
ThirdImportant

This has changed and now they only want Important (since it is hard to
determine what is most important, second most important, and so on).

How can I merge SecondImportant and Third Important into MostImportant?

Thanks,
Drew

Author
22 Sep 2005 5:16 PM
ricva
try the union statement

SELECT RegNo, MostImportant
FROM <table>

UNION
SELECT RegNo, SecondImportant
FROM <table>

UNION
SELECT RegNo, ThirdImportant
FROM <table>
Author
22 Sep 2005 5:19 PM
Akbar khan is a Senior Database develope
Hi there

If you have the data in the table then
* First increase the Most important column Length(means duble)
* Update Table1
   set mostimportant = mostimportant + '  '  + secondImp + '  ' + thirdImp
   Where pId In (SELECT pId FromTable1)

*Delte the columns through Enterprise Manager
Thanks
______________________________________________________________
Show quote
"Drew" wrote:

> We have a small application that holds text data for a report.  Currently it
> looks like this,
>
> RegNo - ID of the person
> MostImportant
> SecondImportant
> ThirdImportant
>
> This has changed and now they only want Important (since it is hard to
> determine what is most important, second most important, and so on).
>
> How can I merge SecondImportant and Third Important into MostImportant?
>
> Thanks,
> Drew
>
>
>
Author
22 Sep 2005 6:30 PM
Drew
That will do it!  I should've known that, but I had a little brain block...

Thanks!
Drew

"Akbar khan is a Senior Database develope"
<AkbarkhanisaSeniorDatabasedevel***@discussions.microsoft.com> wrote in
Show quote
message news:48B5BFB1-FCA2-42B5-AAA3-6894CDDBACA8@microsoft.com...
> Hi there
>
> If you have the data in the table then
> * First increase the Most important column Length(means duble)
> * Update Table1
>   set mostimportant = mostimportant + '  '  + secondImp + '  ' + thirdImp
>   Where pId In (SELECT pId FromTable1)
>
> *Delte the columns through Enterprise Manager
> Thanks
> ______________________________________________________________
> "Drew" wrote:
>
>> We have a small application that holds text data for a report.  Currently
>> it
>> looks like this,
>>
>> RegNo - ID of the person
>> MostImportant
>> SecondImportant
>> ThirdImportant
>>
>> This has changed and now they only want Important (since it is hard to
>> determine what is most important, second most important, and so on).
>>
>> How can I merge SecondImportant and Third Important into MostImportant?
>>
>> Thanks,
>> Drew
>>
>>
>>

AddThis Social Bookmark Button