March 28, 2008 at 10:55 am
This should be easy, but blast-it "I" can figure it out! And we're not at SQL 2005 yet so varchar[MAX] data types are not an option!!!!
Simple scenario, I have ...
[TableA] with
identity column [IDa]
nText data type column [nTextA]
[TableB] with
identity column [IDb]
nText data type column [nTextB]
I want to copy ENTIRE nTextB from TableB
into nTextA in TableA
where
TableA.IDa=55
and
TableB.IDb=222
This is simply copy Field-to-Field ... but it's got me stumped!
P.S. Both TableA and TableB records already exist so I cannot use the INSERT to move the nText field. It must be a done through an UPDATE like mechanism.
March 28, 2008 at 11:58 am
Have you looked at UPDATETEXT in Books Online?
March 28, 2008 at 12:48 pm
I think you want WRITETEXT instead of UPDATETEXT since you are replacing all of the ntext data
I've only tried this in a small test but this worked for me.
create table tablea (
nida int,
ntexta ntext)
create table tableb (
nidb int,
ntextb ntext)
insert into tablea (nida,ntexta) values (55,'This is tablea data')
insert into tableb (nidb,ntextb) values (222,'This is tableb data')
update tableb set ntextb=ntexta
from tablea where nida = 55
March 30, 2008 at 4:01 pm
update tableb set ntextb=ntexta
from tablea
where nida = 55
and nidb = 222
_____________
Code for TallyGenerator
March 31, 2008 at 9:02 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply