ColumnDA: Get columns collation.

This commit is contained in:
2019-10-07 11:20:02 +02:00
parent e030ecd765
commit e326eb754a
3 changed files with 15 additions and 0 deletions

View File

@@ -126,6 +126,16 @@ namespace VAR.DatabaseExplorer.Code.BusinessLogic
{
txtWriter.Write(c.Type);
}
if (string.IsNullOrEmpty(c.Colation) == false && (
c.Type == "nvarchar" ||
c.Type == "varchar" ||
c.Type == "char" ||
c.Type == "nchar" ||
false
))
{
txtWriter.Write(string.Format(" COLLATE {0}", c.Colation));
}
if (c.Nullable)
{
txtWriter.Write(" NULL");

View File

@@ -24,6 +24,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess
c.KeyType AS KeyType,
col.IS_NULLABLE AS Nullable,
CASE WHEN (COLUMNPROPERTY(object_id(col.TABLE_SCHEMA+'.'+col.TABLE_NAME), col.COLUMN_NAME, 'IsIdentity') = 1) THEN 1 ELSE 0 END IsIdentity,
col.COLLATION_NAME Colation,
NULL EmptyColumn
FROM INFORMATION_SCHEMA.COLUMNS AS col
LEFT JOIN (
@@ -81,6 +82,7 @@ namespace VAR.DatabaseExplorer.Code.DataAccess
col.PK = true;
}
col.Indentity = Convert.ToBoolean(dr["IsIdentity"]);
col.Colation = Convert.ToString(dr["Colation"]);
columns.Add(col);
}

View File

@@ -29,5 +29,8 @@ namespace VAR.DatabaseExplorer.Code.DataTransfer
[XmlAttribute]
public bool Indentity { get; set; }
[XmlAttribute]
public string Colation { get; set; }
}
}