Home All Groups Group Topic Archive Search About

appending data to a text column

Author
7 Apr 2006 5:29 PM
kw_uh97
Hello everyone, I'm a newbie so have some mercy please. Please feel free to
make some best practice suggestions. Here we go, I am importing data into a
table within my database. I'll use some DDL for clarity.

Create table ImportTable
(ImportId int Not Null,
ImportLog text (10000)
)

Create table ExistingTable
(Existingid int Not Null,
Existinglog text (10000)
)

When the data is imported I would like to check if the ImportId column in
ImportTable has a match in ExistingId column within ExistingTable, is so I
would like to APPEND the data from ImportLog to ExistingLog

This is a shortened version of the actual table but its give you guys a
general feel for what I am trying to accomplish. Thanks in advance for any
assistance.

kw_uh97

Author
7 Apr 2006 9:51 PM
Anthony Brown
I think this does the job, you need the where condition if it's possible
to have a null entry in the importlog column, for some reason trying to
append null to existingtext converts it to null too:


update existingtable
set existingtext = existingtext + importlog
from existingtable inner join importtable on existingid = importid
where importlog is not null



*** Sent via Developersdex http://www.developersdex.com ***
Are all your drivers up to date? click for free checkup

Author
11 Apr 2006 5:37 PM
kw_uh97
Anthony

Sorry for the delay and thanks for the query it works just fine I will
implement this ASAP.

Thanks, Again
kw_uh97

Show quoteHide quote
"Anthony Brown" wrote:

> I think this does the job, you need the where condition if it's possible
> to have a null entry in the importlog column, for some reason trying to
> append null to existingtext converts it to null too:
>
>
> update existingtable
> set existingtext = existingtext + importlog
> from existingtable inner join importtable on existingid = importid
> where importlog is not null
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

Bookmark and Share