@@ -192,14 +192,16 @@ type internal SqlTypeEntry = {
192192 scale : int16
193193}
194194type internal TableVariableEntry = {
195- name : string
196- system_type_id : byte
197- user_type_id : int
198- is_nullable : bool
199- max_length : int16
200- is_identity : bool
201- is_computed : bool
202- table_type_user_type_id: int
195+ name : string
196+ system_type_id : byte
197+ user_type_id : int
198+ is_nullable : bool
199+ max_length : int16
200+ is_identity : bool
201+ is_computed : bool
202+ table_type_user_type_id : int
203+ precision : byte
204+ scale : byte
203205}
204206
205207type SqlConnection with
@@ -554,13 +556,15 @@ order by
554556 table_ type_ user_ type_ id
555557 , {
556558 table_ type_ user_ type_ id = table_ type_ user_ type_ id
557- name = string reader.[ " name" ]
559+ name = string reader.[ " name" ]
558560 system_ type_ id = unbox< byte> reader.[ " system_type_id" ]
559561 is_ nullable = unbox reader.[ " is_nullable" ]
560562 max_ length = unbox< int16> reader.[ " max_length" ]
561563 is_ identity = unbox reader.[ " is_identity" ]
562564 is_ computed = unbox reader.[ " is_computed" ]
563565 user_ type_ id = unbox< int> reader.[ " user_type_id" ]
566+ precision = unbox< byte> reader.[ " precision" ]
567+ scale = unbox< byte> reader.[ " scale" ]
564568 }
565569 |]
566570 |> Array.groupBy fst
@@ -588,7 +592,11 @@ order by
588592 let getProvidedTypeForSqlTypeEntry ( x : SqlTypeEntry ) = getProvidedType x.name x.is_ user_ defined x.is_ table_ type x.system_ type_ id x.user_ type_ id
589593
590594 let rec makeColumn column =
591- let sqlTypeEntry = sqlEngineTypes.[ column.system_ type_ id, column.user_ type_ id]
595+ let sqlTypeEntry =
596+ { sqlEngineTypes.[ column.system_ type_ id, column.user_ type_ id] with
597+ // important: retrieve the precision / scale from the table variable column entry itself
598+ precision = int16 column.precision
599+ scale = int16 column.scale }
592600 { Column.Name = column.name
593601 TypeInfo = Option.get ( makeTypeInfo sqlTypeEntry)
594602 Nullable = column.is_ nullable
@@ -649,6 +657,9 @@ order by
649657 columns
650658 |> Array.map ( fun column ->
651659 let sqlTypeInfo , typeInfo = typeInfosForTableTypes.[ user_ type_ id]
660+ // important: retrieve the precision / scale from the table variable column entry itself
661+ let precision = int16 column.precision
662+ let scale = int16 column.scale
652663 {
653664 Column.Name = column.name
654665 TypeInfo = typeInfo
@@ -659,8 +670,8 @@ order by
659670 PartOfUniqueKey = false
660671 DefaultConstraint = null
661672 Description = null
662- Precision = sqlTypeInfo. precision
663- Scale = sqlTypeInfo. scale
673+ Precision = precision
674+ Scale = scale
664675 })
665676 else
666677 Array.empty
0 commit comments