示例#1
0
        public void CreateStagingTable(EntityTable table)
        {
            _sql.AppendLine($"create table {table.StagingTable.Name}");
            _sql.AppendLine("(");

            for (int i = 0; i < table.EntityColumns.Count; i++)
            {
                EntityColumn column    = table.EntityColumns[i];
                SqlDbType    sqlDbType = column.GetSqlDbType();

                if (column.IsPrimaryKey())
                {
                    continue;
                }
                else
                {
                    _sql.Append($"{column.Name} {sqlDbType.ToSqlString()} not null");
                }

                _sql.AppendLine(i == table.EntityColumns.Count - 1 ? "" : ",");
            }

            _sql.AppendLine(")")
            .AppendLine();
        }