示例#1
0
        internal static string GetDataTypeDescription(BulkCopyDataType dataType)
        {
            var nullable = (((int)dataType & Constants.NullableDataType) == Constants.NullableDataType);

            dataType = (BulkCopyDataType)((int)dataType & ~Constants.NullableDataType);

            string dataTypeName;

            switch (dataType)
            {
                case BulkCopyDataType.VarBinaryMax:
                    {
                        dataTypeName = "VarBinary(MAX)";
                        break;
                    }
                case BulkCopyDataType.NVarCharMax:
                    {
                        dataTypeName = "NVarChar(MAX)";
                        break;
                    }
                case BulkCopyDataType.VarCharMax:
                    {
                        dataTypeName = "VarChar(MAX)";
                        break;
                    }
                default:
                    {
                        dataTypeName = dataType.ToString("G");
                        break;
                    }
            }

            return dataTypeName + (nullable ? " NULL" : " NOT NULL");
        }