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

Need help optimizing TSQL table valued function

Here is the function: CREATE FUNCTION dbo.agedItemResult(@ILC VARCHAR(30)) RETURNS @AgedTable TABLE ( ItemID INT, ItemLookupCode VARCHAR(30), [Month] INT, [Year] INT, Aged INT, Debug01 VARCHAR(MAX), Debug02 VARCHAR(MAX), Debug03…
jayEss
  • 129
  • 1
  • 1
  • 8
0
votes
1 answer

SQL Server table valued function parameter

I got following table valued function (in SQL Server 2005). I got an compile error when I run --1, but --3 is ok, --2 is used to generate the parameters to be used in --3, which should be the same as in --1. But why --1 got the error? create…
thotwielder
  • 1,563
  • 7
  • 44
  • 83
0
votes
0 answers

Full Text search with 'non-static' searchterm (from joined table variable)

hope (and actually think :) ) that some one already had similar problem and solved it .. the basic issue in short terms .. as the use of a 'wordsearch' feature and the related data will grow rapidly in near future we (in that case means me) need to…
0
votes
1 answer

Error TVP in EF

i use EF + Function in EF + SP for sent and get value at sql 2008. SP: ALTER proc [dbo].[InsertIntoScore] ( @DateReg datetime, @stdLastName nvarchar(50), @stdFirstName nvarchar(50), @Description nvarchar(500), @tvpScore ScoreType…
0
votes
2 answers

How to export Type DataTable (TVP) to a .csv or .xls file?

I want to export TVP (Type of DataTable) to .csv file, or .xls, but more to .csv using aspx. Can you help me with this questuion?
0
votes
1 answer

Generating table argument for stored proc accepting table-valued parameter

I'm calling a stored proc that takes table-valued parameter. I know the following options for passing this parameter: create DataTable, DbDataReader, or IList. I'm using IList (using DataTable is similar), but it…
0
votes
1 answer

How to pass DataTable as a parameter to Stored Procedure by not commiting the current session transaction?

My code looks like this: public void InsertSampleData(DataTable tempTable) { session.Transaction.Commit(); var connection = session.GetSessionImplementation().Connection; using (var sqlConnection =…
-1
votes
1 answer

How to insert values into SQL Server table using Stored procedure in Python

I am new to pytds. Facing TypeError: not enough arguments for format string issue while inserting data into SQL Server. Issue I am getting is: Traceback (most recent call last): File "c:/Users/mydesk/Desktop/test/test_pytds.py", line 64, in…
-1
votes
1 answer

Using SQL data as the data source for an Excel pivot table when the SQL uses an SQL Table Valued function

Using Microsoft Query I'm trying to setup a sql data source for an Excel pivot table, specifically when the sql contains a table valued function. The sql shown in the picture below is how it successfully runs in SSMS. I've used sql as a data source…
-1
votes
1 answer

Inserting data into table from table-valued parameter

I am trying to create a stored procedure to which is passed a TVP and then some data from the TVP is inserted into two tables. I have already implemented the stored procedure, but only the second insert (the only one that does not read from the TVP)…
-1
votes
1 answer

Table value parameters not working with Get method

Actually I'm working using dapper. LoginAuditModel: public class LoginAuditModel { public IList UserIdTableType { get; set; } = new List(); public DateTime StartingDate { get; set; } …
Leon
  • 137
  • 9
-1
votes
1 answer

Insert data from ListView into table valued parameter in vb.net

I have this code in SQL Server 2008, but I try to insert data from my vb.net application - how can I do that? CREATE procedure [dbo].[PO_INSERT_WITH_LINE_ITEM] (@PO_ID smallint = null output, @SUPPLIER_ID smallint, @CREATED_BY…
-1
votes
1 answer

Passing large amount of rows as a User defined Table value Parameter to SP in Sql Azure taking long time

We need to pass around 80K rows to a SP in sql Azure. Previously we are able to do so without any glitches. But currently once we call the SP from c#, it's some times taking 10-15 minutes to start execution in DB and many times the SP is not getting…
-1
votes
1 answer

Why do I get errors when I try to fire stored procedure?

I use SQL Server 2012. I need to pass an array of integers to my stored procedure from Visual Studio. I need to use passed array in where clause. For this purpose I created table valued parameter: CREATE TYPE IdArray AS TABLE ( Id int ); And…
Michael
  • 13,950
  • 57
  • 145
  • 288
-1
votes
1 answer

Empty DataTable Causes Errors When Table-Valued Parameter Has VARBINARY Types

I have a C# web application that serves as a passthrough to SQL Server; requests that detail SQL Server commands come in, we parse the request, generate the necessary .Net types and then use them to execute SqlCommands and such. The upshot of that…
Dan Forbes
  • 2,734
  • 3
  • 30
  • 60
1 2 3
27
28