Alan Ren
2018-08-10 16:28:01 -07:00
committed by GitHub
parent 5cdab53da8
commit fb157520d9

View File

@@ -89,10 +89,19 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData
{
Column smoColumn = smoResult.Columns[i];
string defaultValue = null;
try
{
// The default value may be escaped
string defaultValue = smoColumn.DefaultConstraint == null
defaultValue = smoColumn.DefaultConstraint == null
? null
: FromSqlScript.UnwrapLiteral(smoColumn.DefaultConstraint.Text);
}
catch (PropertyCannotBeRetrievedException)
{
// This exception will be thrown when the user doesn't have view definition privilege,
// we can ignore it and use null as the default value;
}
EditColumnMetadata column = new EditColumnMetadata
{
@@ -113,7 +122,7 @@ namespace Microsoft.SqlTools.ServiceLayer.EditData
}
// Escape the parts of the name
string[] objectNameParts = {smoResult.Schema, smoResult.Name};
string[] objectNameParts = { smoResult.Schema, smoResult.Name };
string escapedMultipartName = ToSqlScript.FormatMultipartIdentifier(objectNameParts);
return new EditTableMetadata