I need to call a stored procedure from VB.NET that takes a table valued parameter. The table structure has three columns, one of which is an sql_variant.
The DataTable I want to pass to this SP has some strings inside the sql_variant column, which converts fine from T-SQL -> .Net, but not the other way around.
The problem is that it's converting string to nvarchar(max) which is incompatible with sql_variant, but as far as I can tell, a conversion to nvarchar(len(s)) would be fine.
So, can I explicitly convert certain cells in a DataTable to a type that will implicitly convert to a finite length nvarchar? Or, can I alter how these .NET types are implicitly converted to SQL types?
Thanks in advance for any help!
Andy