0

Which type do I have to choose if I want to send a DataTable to SQL Server 2008? Because I created my own type for a table to provide the transfer of the datatable.

SqlCommand cmd = new SqlCommand("dbo.LipperFilesTestingInsertFileRowKey", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@DataTable", SqlDbType.???, 512));

SQL

CREATE TYPE [dbo].[keytable] AS TABLE (key varchar(512))

Stored procedure "short form":

create procedure insertkeys
    @indicater, @keys keytable readonly
as
begin
    insert into dbo.tableA 
        select * 
        from @keys
end
2
  • This is covered in the documentation for Table-Valued Parameters Commented Jun 24, 2016 at 7:49
  • so its structured? Commented Jun 24, 2016 at 7:50

1 Answer 1

1

The type you should use is; SqlDbType.Structured

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.