Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Concatenate ntext fields

Author  Topic 

liffey
Yak Posting Veteran

58 Posts

Posted - 2007-07-16 : 06:21:51
This works in SQL 2005 but I need it to run on SQL 2000. Can any of you suggest a workaround please?

What I need to achieve is to read a "note" field (ntext) from one table row and concatenate it with the same field in another row.

declare @SourceJobNumber char(8)
declare @TargetJobNumber char(8)
select @SourceJobNumber = '07G50013'
select @TargetJobNumber = '07G50024'

-- Update notes
UPDATE t
SET
note = convert(varchar(2000),
(select jobnotes.Note from jobnotes where jobnumber = @TargetJobNumber)
)
+ char(13) + char(10) + char(13) + char(10)
+ CONVERT(varchar(2000), s.note)

FROM jobNotes t
JOIN jobNotes s
ON s.JobNumber = @SourceJobNumber
AND t.JobNumber = @TargetJobNumber



-dw

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-16 : 08:06:21
http://www.nigelrivett.net/SQLTsql/InsertTextData.html

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -