diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/ServiceBufferFileStreamReader.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/ServiceBufferFileStreamReader.cs index e46e630e..f662a5d5 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/ServiceBufferFileStreamReader.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/DataStorage/ServiceBufferFileStreamReader.cs @@ -182,7 +182,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage else { Type type; - if (!sqlDBTypeMap.TryGetValue(column.SqlDbType, out type)) + if (column.SqlDbType == SqlDbType.Udt) + { + type = column.DataType; + } + else if (!sqlDBTypeMap.TryGetValue(column.SqlDbType, out type)) { type = typeof(SqlString); } diff --git a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/QueryExecution/DataTypeTests.cs b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/QueryExecution/DataTypeTests.cs index e31abfc8..2970befe 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/QueryExecution/DataTypeTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.IntegrationTests/QueryExecution/DataTypeTests.cs @@ -190,6 +190,12 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.QueryExecution await ExecuteAndVerifyResult("SELECT CAST('1234' AS XML)", "1234"); } + [Test] + public async Task GeometryTypeTest() + { + await ExecuteAndVerifyResult("SELECT geometry::STGeomFromText('POINT (-96.70 40.84)',4326) [Geo]", "0xE6100000010CCDCCCCCCCC2C58C0EC51B81E856B4440"); + } + private async Task ExecuteAndVerifyResult(string queryText, string expectedValue) { // Given a connection to a live database