/// <summary>
        /// Gets the string to create the SQL table.
        /// </summary>
        ///
        /// <remarks>
        /// <example>
        /// <code>
        /// CREATE TABLE BCPTest (
        /// col0 xml,
        /// col1 xml,
        /// col2 nvarchar(max),
        /// col3 varbinary(max)
        /// )
        /// </code>
        /// </example>
        /// </remarks>
        ///
        /// <param name="columns">List of SQL types.</param>
        /// <returns>SQL create table string.</returns>
        static private string GetCreateTableString(IEnumerable <IBCPSerialization> columns)
        {
            StringBuilder createTableString = new StringBuilder();

            createTableString.AppendLine("CREATE TABLE BCPTest (");

            int columnNumber = 0;

            foreach (IBCPSerialization column in columns)
            {
                createTableString.AppendFormat("col{0} ", columnNumber++);

                // FIXME Is there a better way than casting every type?
                // Don't forget to add new SQL types here and to modify the unit tests accordingly
                if (column is SQLBinary)
                {
                    SQLBinary sql = (SQLBinary)column;
                    createTableString.AppendFormat("binary({0})", sql.Length);
                }
                else if (column is SQLChar)
                {
                    SQLChar sql = (SQLChar)column;
                    createTableString.AppendFormat("char({0})", sql.Length);
                }
                else if (column is SQLInt)
                {
                    SQLInt sql = (SQLInt)column;
                    createTableString.Append("int");
                }
                else if (column is SQLNChar)
                {
                    SQLNChar sql = (SQLNChar)column;
                    createTableString.AppendFormat("nchar({0})", sql.Length);
                }
                else if (column is SQLNVarChar)
                {
                    SQLNVarChar sql = (SQLNVarChar)column;
                    if (sql.Length == SQLNVarChar.MAX)
                    {
                        createTableString.Append("nvarchar(max)");
                    }
                    else
                    {
                        createTableString.AppendFormat("nvarchar({0})", sql.Length);
                    }
                }
                else if (column is SQLVarBinary)
                {
                    SQLVarBinary sql = (SQLVarBinary)column;
                    if (sql.Length == SQLVarBinary.MAX)
                    {
                        createTableString.Append("varbinary(max)");
                    }
                    else
                    {
                        createTableString.AppendFormat("varbinary({0})", sql.Length);
                    }
                }
                else if (column is SQLVarChar)
                {
                    SQLVarChar sql = (SQLVarChar)column;
                    if (sql.Length == SQLVarChar.MAX)
                    {
                        createTableString.Append("varchar(max)");
                    }
                    else
                    {
                        createTableString.AppendFormat("varchar({0})", sql.Length);
                    }
                }
                else if (column is SQLNText)
                {
                    SQLNText sql = (SQLNText)column;
                    createTableString.Append("ntext");
                }
                else if (column is SQLText)
                {
                    SQLText sql = (SQLText)column;
                    createTableString.Append("text");
                }
                else if (column is SQLXml)
                {
                    SQLXml sql = (SQLXml)column;
                    createTableString.Append("xml");
                }
                else if (column is SQLReal)
                {
                    SQLReal sql = (SQLReal)column;
                    createTableString.Append("real");
                }
                else if (column is SQLFloat)
                {
                    SQLFloat sql = (SQLFloat)column;
                    createTableString.Append("float");
                }
                else if (column is SQLUniqueIdentifier)
                {
                    SQLUniqueIdentifier sql = (SQLUniqueIdentifier)column;
                    createTableString.Append("uniqueidentifier");
                }
                else if (column is SQLBigInt)
                {
                    SQLBigInt sql = (SQLBigInt)column;
                    createTableString.Append("bigint");
                }
                else if (column is SQLDateTime)
                {
                    SQLDateTime sql = (SQLDateTime)column;
                    createTableString.Append("datetime");
                }
                else if (column is SQLDateTime2)
                {
                    SQLDateTime2 sql = (SQLDateTime2)column;
                    createTableString.Append("datetime2");
                }
                else if (column is SQLDate)
                {
                    SQLDate sql = (SQLDate)column;
                    createTableString.Append("date");
                }
                else if (column is SQLTime)
                {
                    SQLTime sql = (SQLTime)column;
                    createTableString.Append("time");
                }
                else
                {
                    System.Diagnostics.Trace.Assert(false);
                }

                if (columnNumber < columns.Count())
                {
                    createTableString.AppendLine(",");
                }
            }

            createTableString.Append(")");

            return(createTableString.ToString());
        }
 /// <summary>
 /// Writes a SQL ntext.
 /// </summary>
 public void WriteNText(string text)
 {
     SQLNText.Write(_writer, text);
 }