Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP9 updates to VarChar in SQL 2K leaves padded result
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01168557
Message ID:
01168629
Views:
12
Are you sure that serial_no field is varchar in the VFP view?

>Using VFP9 sp1 remote view ODBC linked updateable cursors - of data from tables in an Enterprise SQL 2K database on a W2K3 server - to update certain VarChar type data fields.
>
>Even when the VFP code includes commands such as RTRIM(...) or ALLTRIM(...) or PADR(...) to the exact length of the data, this method leaves a padded result of the data in the destination SQL table which the related Windows Application GUI does not like.
>
>How can I avoid this padding occurring so that I do not have to follow up running Query Analyser to remove the padding? What VFP or SQL settings may be the root of the problem here?
>
>Example:
>
>* create an updateable remote view of the SERHIST table
>CREATE SQL VIEW SERHIST REMOTE ;
>   CONNECTION Connect1 SHARE ;
>   AS ;
>   SELECT ;
>      Serhist.SERHIST_ID,;
>      Serhist.SERIAL_NO,;
>      Serhist.DOC_NO,;
>      Serhist.DOC_TYPE,;
>      Serhist.USER_ID,;
>      Serhist.ASSIGNED_DATE,;
>      Serhist.AREA_CODE;
>   FROM ;
>      dbo.SERHIST Serhist;
>   WHERE ;
>      Serhist.ASSIGNED_DATE >= ( '01/01/2006' );
>   ORDER BY ;
>      Serhist.SERHIST_ID
>
>   * more code here defines the view in detail *
>
>* now open the remote view cursor
>USE SERHIST IN 0 EXCLUSIVE
>
>* now update the 'serial_no' field - we are increasing the effective 'value' of existing data by 341
>* note: 'serial_no' used below is a varchar field
>UPDATE serhist ;
>   SET serial_no = ALLTRIM(STR((INT(VAL(serial_no)) + 341), 7)) ;
>   WHERE doc_no = '80904' AND ;
>         doc_type = 13 AND ;
>         User_id  = '490' AND ;
>         assigned_date = DATE(2006,10,26)
>
>= TABLEUPDATE(.T.)
>
>
>The result of the above is a correct increase in the effective 'value' of serial_no BUT the data is now showing padding in raw data table content when now viewed in Enterprise Manager where un-updated or unchanged data shows no padding of any kind. Why?
>
>Your suggestions for resolution here will be gratefully received. TIA. /psb
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform