@@ -395,17 +395,20 @@ type SqlConnection with
395395 cmd.ExecuteQuery( fun cursor ->
396396 let user_type_id = cursor.TryGetValue " user_type_id"
397397 let system_type_id = cursor.[ " system_type_id" ] |> unbox< int>
398-
398+ let precisionOrdinal = cursor.GetOrdinal( " precision" )
399+ let scaleOrdinal = cursor.GetOrdinal( " scale" )
399400 {
400401 Column.Name = string cursor.[ " name" ]
401402 TypeInfo = findTypeInfoBySqlEngineTypeId ( this.ConnectionString, system_ type_ id, user_ type_ id)
402403 Nullable = unbox cursor.[ " is_nullable" ]
403404 MaxLength = cursor.[ " max_length" ] |> unbox< int16> |> int
404405 ReadOnly = not ( cursor.GetValueOrDefault( " is_updateable" , true ))
405406 Identity = cursor.GetValueOrDefault( " is_identity_column" , false )
406- PartOfUniqueKey = cursor.GetValueOrDefault( " is_part_of_unique_key" , false )
407+ PartOfUniqueKey = cursor.GetValueOrDefault( " is_part_of_unique_key" , false )
407408 DefaultConstraint = null
408409 Description = null
410+ Precision = int16 ( cursor.GetByte precisionOrdinal)
411+ Scale = int16 ( cursor.GetByte scaleOrdinal)
409412 }
410413 )
411414 |> Seq.toList
@@ -434,6 +437,8 @@ type SqlConnection with
434437 PartOfUniqueKey = false
435438 DefaultConstraint = null
436439 Description = null
440+ Precision = unbox row.[ " NumericPrecision" ]
441+ Scale = unbox row.[ " NumericScale" ]
437442 }
438443 ]
439444
@@ -480,7 +485,7 @@ type SqlConnection with
480485 then
481486 [|
482487 use cmd = new SqlCommand( "
483- SELECT c.name, c.system_type_id, c.user_type_id, c.is_nullable, c.max_length, c.is_identity, c.is_computed
488+ SELECT c.name, c.system_type_id, c.user_type_id, c.is_nullable, c.max_length, c.is_identity, c.is_computed, c.[precision], c.scale
484489 FROM sys.table_types AS tt
485490 INNER JOIN sys.columns AS c ON tt.type_table_object_id = c.object_id
486491 WHERE tt.user_type_id = @user_type_id
@@ -490,6 +495,8 @@ type SqlConnection with
490495 cmd.Connection <- this
491496 use reader = cmd.ExecuteReader()
492497 while reader.Read() do
498+ let precisionOrdinal = reader.GetOrdinal " precision"
499+ let scaleOrdinal = reader.GetOrdinal " scale"
493500 let user_type_id = reader.TryGetValue " user_type_id"
494501 let stid = reader.[ " system_type_id" ] |> unbox< byte> |> int
495502 yield {
@@ -502,6 +509,8 @@ type SqlConnection with
502509 PartOfUniqueKey = false
503510 DefaultConstraint = null
504511 Description = null
512+ Precision = int16 ( reader.GetByte precisionOrdinal)
513+ Scale = int16 ( reader.GetByte scaleOrdinal)
505514 }
506515 |]
507516 else
0 commit comments