Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server VARCHAR(MAX)
Message
From
19/05/2022 07:52:20
 
 
To
19/05/2022 03:21:48
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01684381
Message ID:
01684385
Views:
65
Hi Al,

A bit late to the party, esp. as solution already found...

One of my first attempts on running into such walls with vfp is to try OLEDB instead of ODBC -
even if MS did 180 last decade sidelining COM based OLEDB and pushing ODBC again -
as vfp EOL was still earlier, OLEDB gives more current / less hidebound routines better fitted to vfp.

As long as vfp does run on real Win (instead of Wine/PlayOnLinux or similar)
not a problem as OS is already defined and supporting COM (better than bracketed above).

my 0.02€
thomas

>I didn't design the DB - I'm just pulling data out of it ;)
>
>>But if the max length in that field is 252 why it is varchar(max)?
>>
>>
>>>I'm using VFP9 and SQL pass-through to extract data from a SQL Server 2012 database. The DB is the back-end for a VFP app.
>>>One field in the app is an editbox which allows multi-line input with line breaks. It's backed by a SQL Server VARCHAR(MAX) column (call it "MultiCol"). ISTR there are some issues with this depending on version of SQL Server and ODBC driver. Maximum length of the contents of this column is 252.
>>>I've tried passing through several SQL queries:
>>>
SELECT * FROM dbo.MyTable
>>>I get some columns but nothing in MultiCol.
>>>
* CAST to char():
>>>SELECT Col1, Col2, CAST( MultiCol AS char(254) ) AS MultiCol FROM dbo.MyTable
>>>* CAST to varchar():
>>>SELECT Col1, Col2, CAST( MultiCol AS varchar(254) ) AS MultiCol FROM dbo.MyTable
>>>
>>>These give me the contents but line breaks are stripped out.
>>>Anyone have any suggestions for getting the content while preserving the line breaks?
>>>
>>
>>
>>>UPDATE: CASTing to TEXT brings the contents across into a VFP Memo field, preserving line breaks:
>>>
SELECT Col1, Col2, CAST( MultiCol AS text ) AS MultiCol FROM dbo.MyTable
Previous
Reply
Map
View

Click here to load this message in the networking platform