Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 Tags
Subject: RE: CAST Something AS M (binary) - ?
Thread ID: 143693 Message ID: 143815 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Friday, August 31, 2007 5:57:56 PM         
   


> Colleagues,
>
> I need an "artificial" field of type Memo (binary) in the resulting SQL SELECT query to store a string with CRs in it.
>
> I tried
CAST(Something AS M NOCPTRANS)
and VFP rejected it.
> I tried
CAST(Something AS "M NOCPTRANS")
and VFP rejected it.
> I put "M NOCPTRANS" into lcMemoBin memvar and tried
CAST(Something AS (lcMemoBin))
and VFP rejected it.
> I tried
CAST(Something AS &lcMemoBin)
and VFP rejected it.
>
> I cannot resort to G type field - this type of conversion ain't supported (see VFP Help on CAST() Function).
>
> Out of bitter desperation, I even tried type VarBinary, i.e.
CAST(Something AS Q(LEN(Something)))
- but that gave me, well, binary data (and I need readable string, mind you).
>
> Out of even more biiter desperation, I even tried type VarChar, i.e.
CAST(Something AS V(LEN(Something)))
- but that gave me just ordinary field of Char type with that data (and CR's appeared as those black rectangles, as they always do).
>
> Out of total desperation, I even tried
CAST(Something AS W
the result was the same as with Q, albeit in a Memo-like Blob field - and even my angelic patience runeth out. (|:<)
>
> In short: I need to cast my data as an ol' good Memo (binary) field, bleen! Any way of achieving this?
>
> TIA!
>
> Regards,
>
> Ilya

Ilya,
Borislav was right about BLOB. Internally it's the same thing as M Nocptrans.
I think just casting as M would do the job unless you're transferring that data between layers that do codepage translation.
If you need it as nocptrans anyway then you have 2 options:
1) Create the cursor beforehand and append your select result into it.

insert into myCursor (...) select ...

2) Do your select into a readwrite cursor and alter table to mark the column as nocptrans.

select ....
alter table myCursor alter column myMemoField m nocptrans

Cetin Basoz

ENTIRE THREAD

CAST Something AS M (binary) - ? Posted by Ilya Rabyy @ 8/31/2007 12:04:37 AM
RE: CAST Something AS M (binary) - ? Posted by Yull67 @ 8/31/2007 2:03:34 AM
RE: CAST Something AS M (binary) - ? Posted by Borislav Borissov @ 8/31/2007 9:00:13 AM
RE: CAST Something AS M (binary) - ? Posted by Ilya Rabyy @ 8/31/2007 4:42:08 PM
RE: CAST Something AS M (binary) - ? Posted by Ilya Rabyy @ 8/31/2007 4:33:42 PM
RE: CAST Something AS M (binary) - ? Posted by Yull67 @ 8/31/2007 4:54:00 PM
RE: CAST Something AS M (binary) - ? Posted by Ilya Rabyy @ 8/31/2007 5:27:50 PM
RE: CAST Something AS M (binary) - ? Posted by Yull67 @ 8/31/2007 6:05:46 PM
RE: CAST Something AS M (binary) - ? Posted by Ilya Rabyy @ 8/31/2007 6:33:09 PM
RE: CAST Something AS M (binary) - ? Posted by Cetin Basoz @ 8/31/2007 5:57:56 PM
RE: CAST Something AS M (binary) - ? Posted by Ilya Rabyy @ 8/31/2007 6:09:57 PM
RE: CAST Something AS M (binary) - ? Posted by Cetin Basoz @ 8/31/2007 11:32:32 PM