The following applies to SQL Server 2000.
1) The ANSI_PADDING setting controls how trailing spaces are handled. With ANSI_PADDING ON SQL does not trim trailing spaces. See "SET ANSI_PADDING" in SQL BOL.
2) "nchar, nvarchar, and ntext columns always display the SET ANSI_PADDING ON behavior, regardless of the current setting of SET ANSI_PADDING. Therefore, SQL Server does not trim trailing spaces on nvarchar columns." (Source: SQL BOL)
3) When ANSI_PADDING ON, SQL Server will not add trailing spaces to varchar columns. It does not add trailing spaces to nvarchar columns regardless of the ANSI_PADDING setting.
4) "The SQL Server ODBC driver and Microsoft OLE DB Provider for SQL Server automatically set ANSI_PADDING to ON when connecting. This can be configured in ODBC data sources, in ODBC connection attributes, or OLE DB connection properties set in the application before connecting." (Source: SQL BOL)
4) I'm not familiar with FoxPro. In VB, if a variable is DIMmed with a fixed length and that variable is used to insert data into a column trailing spaces will be added. Trimming does not remove the spaces. The variable must be DIMmed as variable length to allow trimming of trailing spaces.
Example: variable length string
DIM strTest As String
Example: fixed length string (20 characters)
DIM strTest As String * 20
Does FoxPro allow fixed and variable length strings? If it does, you should change fixed length strings to variable length so trimming can occur without a lot of additional coding.
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.