Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Julio Laborin
  Where is Julio Laborin?
 Ciudad Juarez
 Mexico
 Julio Laborin
 Tags
Subject: RE: Problem with SELECT and MEMO field
Thread ID: 189197 Message ID: 189203 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Wednesday, August 13, 2008 8:05:07 PM         
   


> In order to get the default values on my CA, I need to define them in the CursorSchema property . Something like this :
>
>
CursorSchema =  "CODIGO I,DESCRIP C(50) DEFAULT('Description Here')"

>
> To accomplish this, I made a SELECT :
>
>
>
Sql_Query="SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=MyTable"
> result=SQLEXEC(m.Sql_lnHandle, Sql_Query, 'MySchema')

>
>
> If I BROWSE the table, MySchema.column_default is a MEMO field, but here is the 1st problem, the information looks different from what I see in the SQL Management Studio, here is padded with spaces, example :
>
>
> In SQL :
>
> ("'Description Here'")
>
>
> In my CA :
>
> ( " ' D e s c r i p t i o n h e r e ' " )
>
>
> The 2nd problem is If I try to read the information of the MEMO field, I only get 1 character :-O
>
>
>
MESSAGEBOX(MySchema.column_default )      && Shows (   

>
>
> I checked the type and length of the field, it seems correct, but I cant get the info correctly , I have tried with :
>
>
>
> 	SUBSTR
>       	MLINE
>       	ATC 

>
> Same result, I am getting just 1 character .


The padding with spaces is simply because it's Unicode. STRCONV() con turn that into 8-bit ANSI chars.
There is a CA property to automate it as I recall, and a SYS() function as well.
A CAST() in the query could perhaps also handle it.
-Anders

ENTIRE THREAD

Problem with SELECT and MEMO field Posted by Julio Laborin @ 8/13/2008 7:40:33 PM
RE: Problem with SELECT and MEMO field Posted by Anders Altberg @ 8/13/2008 8:05:07 PM
RE: Problem with SELECT and MEMO field Posted by Yuri Rubinov @ 8/13/2008 8:21:07 PM
RE: Problem with SELECT and MEMO field Posted by Anil Sharma @ 8/13/2008 8:24:06 PM
RE: Problem with SELECT and MEMO field Posted by Julio Laborin @ 8/13/2008 8:35:55 PM