How to transfer a table from an external interface to a stored procedure?

I want to pass a table as a parameter to a stored procedure. Is it possible to do this. Please provide some examples.

+4
source share
2 answers

In SQL Server 2008, you can use the Parameter Value Table — pass the type TABLE as the sproc parameter.

I wrote an article about the differences in the various approaches you could take using performance comparison: CSV vs XML vs Table Valued Parameter

+6
source

Solution to this

Convert your data to xml with datatable.Writexml

how to pass this xml as a string in the stored procedure routine keeper with data type Varchar (max)

Instead of using OpenXml to create a datatable, again create the xml string you submitted.

See an example: http://msdn.microsoft.com/en-us/library/ms186918.aspx

+1
source

Source: https://habr.com/ru/post/1308996/


All Articles