diff --git a/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs b/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs index 510d1fc64b..4cfc49caeb 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/EditData/SmoEditMetadataFactory.cs @@ -93,6 +93,10 @@ public EditTableMetadata GetObjectMetadata(DbConnection connection, string[] obj throw new ArgumentOutOfRangeException(nameof(objectNamedParts), SR.EditDataObjectNotFound); } + // Filter out dropped ledger columns from the list of columns to be returned + // and grab the specific column properties checked below + smoResult.Columns.ClearAndInitialize("[(@IsDroppedLedgerColumn=0)]", new [] { nameof(Column.DataType), nameof(Column.DefaultConstraintName) }); + // Generate the edit column metadata List editColumns = new List(); for (int i = 0; i < smoResult.Columns.Count; i++) @@ -103,7 +107,7 @@ public EditTableMetadata GetObjectMetadata(DbConnection connection, string[] obj try { // The default value may be escaped - defaultValue = smoColumn.DefaultConstraint == null + defaultValue = string.IsNullOrEmpty(smoColumn.DefaultConstraintName) ? null : FromSqlScript.UnwrapLiteral(smoColumn.DefaultConstraint.Text); }