|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Merging 2 varchar columns into 1We 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 try the union statement
SELECT RegNo, MostImportant FROM <table> UNION SELECT RegNo, SecondImportant FROM <table> UNION SELECT RegNo, ThirdImportant FROM <table> 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 > > > 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 >> >> >> |
|||||||||||||||||||||||