You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a User Defined Table Type it appears to write the value to the wrong column, resulting in a database conversion error. Using the SQL profiler I can see this error occurs before executing the SQL and only when the @parameter has one or more items. If it is empty or removed the command executes successfully.
Error
System.Data.SqlClient.SqlException: 'Conversion failed when converting the nvarchar value 'TestName' to data type int.
The statement has been terminated.'
To Reproduce
Possibly share SQL Schema, snippets of data, and how you call it in F#.
Sample to reproduce the behavior:
Table and Table Type
Create Table [TestTable] (
[C1] UniqueIdentifier Not Null,
[C2] UniqueIdentifier Not Null,
[C3] UniqueIdentifier Not Null,
[C4] NVarChar(100) Not Null,
[C5] NVarChar(100) Not Null,
[C6] NVarChar(100) Null,
[C7] NVarChar(1000) Not Null,
[C8] Int Not Null,
[C9] VarChar(10) Not Null,
[C10] UniqueIdentifier Not Null,
[C11] UniqueIdentifier Not Null,
Constraint [PK_Id] Primary Key Clustered([C1], [C2], [C3])
);
Create Type [dbo].[TestTableItem] AS Table(
[C3] UniqueIdentifier Not Null,
[C5] NVarChar(100) Not Null,
[C6] NVarChar(100) Null,
[C7] NVarChar(1000) Not Null,
[C8] Int Not Null,
[C9] VarChar(10) Not Null,
[C10] UniqueIdentifier Not Null
);
@daniellittledev I've tried to reproduce the issue in #425 but the added test doesn't throw a SqlException, do you mind trying it out and adjust the test accordingly to reproduce your issue?
Issue Summary
When using a User Defined Table Type it appears to write the value to the wrong column, resulting in a database conversion error. Using the SQL profiler I can see this error occurs before executing the SQL and only when the @parameter has one or more items. If it is empty or removed the command executes successfully.
Error
To Reproduce
Possibly share SQL Schema, snippets of data, and how you call it in F#.
Sample to reproduce the behavior:
Table and Table Type
SqlCommandProvider
Usage
Expected behavior
The query should successfully insert a new row.
What you can do
The text was updated successfully, but these errors were encountered: