|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
appending data to a text columnmake 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 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 *** 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 *** >
Other interesting topics
Advanced T-SQL Question: Produce Backup Window Gantt Chart
Prioritise the execution of a specific Stored Procedure SQL/CLR books Invalid Column Names? Why am I missing rows in my result set? Unexpected NOT IN results Performance question SQL Performance difference [OT] There should be a law... how to get back image from table? |
|||||||||||||||||||||||