Consultor Eletrônico



Kbase P129336: A field with nvarchar(max) data type in MS SQL Server has a display format of x(1) in the schema hol
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/6/2008
Status: Unverified

FACT(s) (Environment):

Windows 2003
Windows NT 32 Intel/Windows 2000
MS SQL DataServer
OpenEdge 10.1C
MS SQL 2005
OpenEdge 10.1B

SYMPTOM(s):

OpenEdge 10.1B03

A field with nvarchar(max) data type in MS SQL Server has a display format of x(1) in the schema holder

The following is shown in the .df file from the schema holder for field f1 for table t1:

ADD FIELD "f1" OF "t1" AS character
FORMAT "x(1)"
INITIAL ?
POSITION 2
LENGTH 0
ORDER 5010
FOREIGN-POS 1
FOREIGN-NAME "f1"
FOREIGN-TYPE "NVARCHAR"
DSRVR-PRECISION 0
DSRVR-SCALE 0
DSRVR-LENGTH 0
DSRVR-FLDMISC 0
FIELD-MISC22 "Y"
QUOTED-NAME """f1"""
MISC-PROPERTIES ""

The schema holder is created with Unicode support from %DLC%\prolang\utf\empty4

The code page is changed to utf-8 from default iso8859-1 during the schema holder creation process

The MS SQL Server Native Client driver is used to access the SQL Server database

Use of the SQL Server driver to connect to SQL Server Database resolves the display format issue

CAUSE:

The issue with the MS SQL Server Native Client driver is that when API call is made to query the field's information, it returns the field to be of type nvarchar with size 0. The DataServer handles it as nvarchar and sets its display format to be of length 1. On the other hand, the SQL Server driver returns the field to be of type ntext with a long size, therefore, the DataServe sets its display format to x(320) and handles it properly.

FIX:

As a workaround use SQL Server driver to connect to MS SQL Server database