Questions tagged [table-valued-parameters]

Table-Valued Parameters is a feature introduced in SQL SERVER 2008. In earlier versions of SQL SERVER it is not possible to pass a table variable in stored procedure as a parameter, but in SQL SERVER 2008 we can use Table-Valued Parameter to send multiple rows of data to a stored procedure or a function without creating a temporary table or passing so many parameters.

Table-valued parameters are like parameter arrays in OLE DB and ODBC, but offer more flexibility and closer integration with Transact-SQL. Table-valued parameters also have the benefit of being able to participate in set-based operations

Transact-SQL passes table-valued parameters to routines by reference to avoid making a copy of the input data.

http://msdn.microsoft.com/en-us/library/bb510489.aspx

Table-valued parameters are declared by using user-defined table types. You can use table-valued parameters to send multiple rows of data to a Transact-SQL statement or a routine, such as a stored procedure or function, without creating a temporary table or many parameters. Table-valued parameters are like parameter arrays in OLE DB and ODBC, but offer more flexibility and closer integration with Transact-SQL. Table-valued parameters also have the benefit of being able to participate in set-based operations. Transact-SQL passes table-valued parameters to routines by reference to avoid making a copy of the input data. You can create and execute Transact-SQL routines with table-valued parameters, and call them from Transact-SQL code, managed and native clients in any managed language.

411 questions
0
votes
1 answer

SQL Server Table Valued Params and Memory?

I have a sproc that generates an 80,000-row temp table which is passed as a table-valued parameter to 32 different other sprocs (each sproc the TVP as an input parameter). Should I be concerned that I am going to get a balloon of memory I can't…
0
votes
2 answers

How to use Table -Valued Parameter with Dynamic qry

I am using Table - Valued Parameter for to build dyNamic Query Using the Following code AlTER PROCEDURE [dbo].[ABC] @tblName Varchar(1000), @Details ABC_TYPE Readonly AS BEGIN Declare @PK as nvarchar(1000) Declare…
0
votes
1 answer

How to use table valued parameter with the IN keyword

Edit: I tried to replace: @LocationIDs NVARCHAR(MAX) = null, with @LocationIDs LocationIdArray READONLY, but now I get an error saying: Must declare the scalar variable "@LocationIDs". --END EDIT-- I have this stored procedure that I need to…
Paco G
  • 391
  • 1
  • 3
  • 15
0
votes
2 answers

The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect

There are many questions regarding this error, but none seem related. The original exception we get Der eingehende Tabular Data Stream (TDS) für das RPC-Protokoll (Remote Procedure Call) ist nicht richtig. 0-Tabellenwertparameter (""), Zeile 0,…
CSharpie
  • 9,195
  • 4
  • 44
  • 71
0
votes
0 answers

Losing contents of a SQL User Defined Table Type/Table-ValueType in SP

I'm calling an sp(Sp1) from .Net, passing a data table (as SqlDbType.Structured). Sp1 has a parameter defined as a udtt, "CREATE TYPE udttInteger AS Table (Id INT)". Sp1 then dynamically calls Sp2 passing the same udtt parameter. .Net(Data…
S Osborn
  • 87
  • 1
  • 5
0
votes
1 answer

Search in a table using two parameters where one of them is a list of integers

I am trying to create a stored procedure to use in my web api using ASP.NET and C#. I have a table where there are three columns like this: Id |TranName|ConfigName ---|--------|---------- 10 |ABC |abcd 11 |BDE |bdef 12 |FGH |fghi 13 |HIJ…
0
votes
1 answer

How can I get NHibernate to make a multicolumn table-valued parameter?

I'd like to pass a two-column table-valued parameter (TVP) to an ISQLQuery: var sql = "INSERT INTO MovieRatings (PersonID, MovieID, Score) " + "SELECT :personID, o.movieID, o.score " + "FROM :scoreObject o"; var query =…
Michael
  • 8,362
  • 6
  • 61
  • 88
0
votes
1 answer

Calling stored procedure with table value parameters returns no rows

I am using entity framework 6, calling a stored procedure which takes a table value parameter. The stored procedure executes without error but returns no rows. I use profiler to trace the call so I can see how EF executes it. If I manually call…
0
votes
1 answer

Auto Increment SQL Value

In the infinte wisdom of the global DBA at a firm I am working at right now he has created a table that takes an int as an ID field, but does not auto increment the number. I am passing up a table valued parameter from .Net because it has roughly…
0
votes
0 answers

How do I debug a TableValued SQL function

I have a database with a table valued function in it that I use to implement a CONTAINSTABLE query. It looks like this: CREATE Function [dbo].[FreeTextSearch_Usage] (@SearchString varchar(1024) ) returns table AS return Select top 750 rank,…
0
votes
0 answers

Query arguments using Table-Valued Parameters?

I want run a big SELECT query that can take 20 filtering criteria where each criteria can have multiple values and can also be NULL. The way I'm doing it presently is by generating the SQL query on the fly depending on the filtering criteria that I…
Guillaume Filion
  • 480
  • 2
  • 6
  • 13
0
votes
1 answer

T-SQL Stored Procedure Join Table Valued Parameter Twice

I have a table valued parameter that I want to join, not just once, but twice. Once to get a row, and the second time to get the parent row. I am almost certain this can be done with normal tables. Can it be done with table valued parameters? USE…
Ayo I
  • 7,722
  • 5
  • 30
  • 40
0
votes
1 answer

Inserting numeric data with non zero scale with table-valued parameter

I am using table-valued parameters to insert large amounts of data into various tables. When those tables have numeric columns with scale and in a single data table there are rows that have varying numbers of scale I get the following error: The…
john
  • 1
  • 3
0
votes
2 answers

How to use stored procedure with table-valued parameters to compare two input tables

I am trying to write a stored procedure to compute the differences between two input tables. Stored procedure is used to calculate differences between two tables (both tables have the same predefined table structure), the stored procedure will…
0
votes
2 answers

What is the equivalent passing array int to stored procedure .net 4.6 code for .net core?

So this link, shows how to pass an int array to stored procedure. CREATE TYPE dbo.EmployeeList AS TABLE ( EmployeeID INT ); GO CREATE PROCEDURE dbo.DoSomethingWithEmployees @List AS dbo.EmployeeList READONLY AS BEGIN SET NOCOUNT ON; SELECT…
bbusdriver
  • 1,577
  • 3
  • 26
  • 58