I have some old Rich View RTF data stored in nVarChar(MZX). Now I need to use VarBinary to work with SRV. I tried SQL Convert Function but it came out a mess.
Short of exporting all the data, converting then importing it, is there some way I can do the conversion ?
Thanks.
Migrating Data from nVarChar to VarBinary
Additional Info
I just like to add some more about the Data migration problem for me.
The old editor is just plain TRich View not SRV, and I used the DB aware version.
Thanks.
The old editor is just plain TRich View not SRV, and I used the DB aware version.
Thanks.
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I assume you added VarBinary field to the same table as contains nVarChar.
You can do the following.
Place dbsrv:TDBSRichViewEdit on the form, connect it to the source (nVarChar) field.
Let table is a data set connected to this table (and to TDBSRichViewEdit).
Let FieldName is a name of destination (VarBinary) field.
You can do the following.
Place dbsrv:TDBSRichViewEdit on the form, connect it to the source (nVarChar) field.
Let table is a data set connected to this table (and to TDBSRichViewEdit).
Let FieldName is a name of destination (VarBinary) field.
Code: Select all
var Stream: TStream;
table.First;
while not table.EOF do begin
table.Edit;
Stream := table.CreateBlobStream(tbl.FieldByName(FieldName), bmWrite);
dbsrv.RichViewEdit.SaveRVFToStream(Stream, False);
Stream.Free;
table.Post;
table.Next;
end;