Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP to SQL Server String conversion

Status
Not open for further replies.

JBalcerzak

Programmer
Sep 5, 2002
73
0
0
US
Hello -

Working on a conversion routine to move an old VFP5 DB to SQL Server. When I update a string field on SQL Server with data from the VFP DB, it pads the remainder of the string with spaces if the string I'm sending is smaller than the field size in the SQL DB. Any way I can get VFP to not add on the extra spaces on string fields?

Thanks,

Jeff
 
Jeff,

This is a familiar problem. It happens with Varchar fields when you add or update a record via a remote view. Basically, there's nothing you can do about it if you want to use remote views.

To avoid the problem, use SQLEXEC() to send an INSERT or UPDATE command to the server. In that command, use ALLTRIM() to get rid of the extra spaces.

It is also possible to avoid the problem by using cursoradapters, but since you mentioned that you are using VFP 5.0, that solution won't be available to you.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks, I'll give that a try. Right now, I've got a T-SQL script that I'm running through Enterprise Manager to clean the data before I use it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top