Subject Re: CAST() string as BLOB for use as a memo field in VFP
Author Bhavbhuti Nathwani

--- In, Helen Borrie <helebor@...> wrote:
> Alright. As you are handling strings, your main limitation is that
a varchar must not exceed 32,765 *bytes* in length. If you are using
MBCS, the limit would be proportionately shorter in *characters*.

OK. I tried to CAST(... AS VARCHAR(32000)) and I got back a memo
field. I can live with 32000 bytes no problem.

> I don't know what sort of "template" you had in mind. You can't
format strings, other than to include tab and CRLF characters. But it
would be feasible to construct the string by concatenating varchars in
a stored procedure and return it directly to the caller, without need
to store a blob.

Something contained in a FireBird table field like:
'Invoice no. ' + TO_STRING(InvTable.NoFld) + ' dtd. ' +
TO_STRING(InvTable.DtFld) + ' Party ' + InvTable.PartyNameFld

Assuming there is either a STRING() or TO_STRING() function / UDF that
can be used in FireBird at SELECT time. Can such a string in a field
textmerge into a usable string, eg. 'Invoice no. 123 dtd. 19/11/20007
Party A.B.C. and Co.'?

If not, can this above be done in a Stored Procedure? If I can do
something like:

SELECT MySP() AS mNarration FROM InvTable WHERE ...

> However, you can pass a string literal to a text blob, nothing that
blobs are never "updated". Updating a blob means replacing the old
blob with a new one. The engine makes this transition for you.

Though I don't want to send the BLOB nor the updated one back to
FireBird for storage.