سؤال

I am migrating a Visual FoxPro database to SQL Server. One of the tables has a Char column with length 2147483647. I am wondering if the correct data type to use in SQL Server 2008 R2 is Char(2147483647). Is there an alternative type I can use in SQL Server which will not result in any loss of information?

The following image gives a description of the column as shown within Visual Studio 2008.

Visual FoxPro Char column properties

هل كانت مفيدة؟

المحلول

Visual FoxPro's native CHAR type only allows up to about 255 characters. What you're seeing is a FoxPro MEMO field, translated to a generic OLE equivalent.

A SQL Server VARCHAR(MAX) is the usual proper equivalent, assuming the MEMO is simply user-entered text in a western dialect and not a multi-linqual or data-blob variation.

Be aware that FoxPro does NOT speak UTF natively, so you may have code-page translation issues.

نصائح أخرى

Hope this helps someone else.

MSDN varchar description states:

Use varchar(max) when the sizes of the column data entries vary considerably, and the size might exceed 8,000 bytes.

The maximum storage for Char is 8000 bytes/characters. varchar(max) on the other hand will use a storage size equal to the actual length of the characters entered plus 2 bytes.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top