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_uh97I 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.examnotes.net ***|||Anthony
Sorry for the delay and thanks for the query it works just fine I will
implement this ASAP.
Thanks, Again
kw_uh97
"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.examnotes.net ***
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment