Link to home
Start Free TrialLog in
Avatar of Jim Philippi
Jim Philippi

asked on

SQL Server varChar(max) field adds spaces to VFP Memo field in remote view

I have a VisualFoxPro (VFP) application being ported to a sqlserver backend.  The app has a memo field that contains more than 10,000 characters in come cases.  Using a varChar(max) causes a problem, the VFP view retrieves the data but there is an extra space between every character, doesn't really edit well, and will not update back to the server.  Is there a workaround or solution?
Avatar of ste5an
ste5an
Flag of Germany image

Sounds like a Unicode conversion error. Imho the backend column should be NVARCHAR(MAX) instead.
Avatar of Jim Philippi
Jim Philippi

ASKER

Sadly ste5an, that did not resolve the issue.  Thanks though.
Well, use SSMS to look at the data. It's possible that you already have bad data. So you need to redo your data copy task.
Data's good.  Oddly, if I have both a varChar(max) and an nvarChar(max) field in the server database I'm able to access the varChar(max) data without issue.  Go figure?  Hoping that's the "solution."  Thanks for the help!
It still sounds like you have both VARCHAR and NVARCHAR fields and assume some NVARCHAR fieds to be varchar, while they're not.
Or you (or "something") even converted text on the client side to Unicode before storing it to Varchar, thus storing unicode in non unicode fields.

For how VFP retrieves data as Unicode or Ansi also look into SYS(987) and mapvarchar setting of the connection.

Besides all that the SQL Server ODBC driver series works better in VFP than SQL Native Client ODBC, especially SQL Native Client might give you Char(0) fields instead of VFPs varchar(max) equivalent of Memo fields, even though char(0) is a column type you can't create with CREATE TALBE or CREATE VIEW yourself. There is some mismatch of VFP and ODBC at work here, maybe.

Bye, Olaf.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.