When using a TVP, containing multiple columns, the columns order in F# is not the expected order (the order the columns were declared, i.e. column_id).
To Reproduce
CREATE TYPE [dbo].[TVPColumnOrder] AS TABLE(
[Param1] INT NOT NULL,
[Param2] NVARCHAR(100) NOT NULL,
[Param3] BIT NOT NULL
)
GO
CREATE PROCEDURE [dbo].[TestTVPColumnOrder](
@tvpColumnOrder [dbo].[TVPColumnOrder] READONLY
)
AS
SELECT *
FROM @tvpColumnOrder
GO
type TestTVPColumnOrder = SqlCommandProvider<"EXEC [dbo].[TestTVPColumnOrder] @tvp", ConnectionStrings.AdventureWorksLiteral>
let someFunc () =
use cmd = new TestTVPColumnOrder(ConnectionStrings.AdventureWorksLiteral)
[
(1, "some string", true)
(2, "some other string", false)
(3, "yet another string", true)
]
|> Seq.map (fun (i, s, b) -> TestTVPColumnOrder.TVPColumnOrder(i, s, b))
...
Error
The above will result in 2 compilation errors:
The type required for this expression is 'bool', but 'string' was specified
and
The type required for this expression is 'string', but 'bool' was specified
Referring to the 2nd and 3rd arguments to TestTVPColumnOrder.TVPColumnOrder
Expected behavior
Things to compile without error.
What you can do
[x] I am willing to contribute a PR with a unit test showcasing the issue
[x] I am willing to test the bug fix before next release
Issue Summary
When using a TVP, containing multiple columns, the columns order in F# is not the expected order (the order the columns were declared, i.e. column_id).
To Reproduce
Error
The above will result in 2 compilation errors:
and
Referring to the 2nd and 3rd arguments to
TestTVPColumnOrder.TVPColumnOrder
Expected behavior
Things to compile without error.
What you can do