Skip to main content

Questions tagged [table-valued-parameters]

TVPs are a feature of Microsoft SQL Server. Introduced in SQL Server 2008, TVPs allow for sending a structured table of data to a stored procedure or function. Using TVPs can improve performance over sending multiple rows as XML or doing row-by-row processing.

7 votes
2 answers
417 views

I have a query that is both prone to parameter sensitivity and is suffering from its table-valued parameter. I'm lazy and just want to solve this with query hints. When I'm lazy, I can solve parameter ...
J. Mini's user avatar
  • 1,342
6 votes
2 answers
346 views

With the database setup CREATE TYPE dbo.TableType AS TABLE ( prop1 int, prop2 datetime2, prop3 varchar(1000) ); GO CREATE OR ALTER PROC dbo.TestTableTypePerf @Data dbo.TableType READONLY AS SELECT ...
Martin Smith's user avatar
  • 88.7k
10 votes
3 answers
2k views

I've found that using TVPs to pass multiple values to a stored procedure is much easier and faster, especially when dealing with a few columns and a few hundred rows, as it eliminates the need for ...
lifeisajourney's user avatar
0 votes
1 answer
94 views

I have defined an In-Memory Table Type to hold a sequence of unique integers for the purpose of passing them between stored procedures. The type has the following definition: CREATE TYPE [dbo].[...
Dan Def's user avatar
  • 165
14 votes
1 answer
2k views

My version of SQL Server is SQL Server 2019 (RTM-CU18). The following repro code requires that an in memory filegroup is created. For anyone following along, please remember that an in-memory ...
Joe Obbish's user avatar
  • 33.3k
2 votes
1 answer
490 views

I'm relatively new to database programming and am looking for some some theory/best practices and feedback on an issue involving multiple dependent, cascading, computed columns for an OLTP SQL Server/...
Will Adams's user avatar
9 votes
1 answer
303 views

I am testing on SQL Server 2019 CU14. Consider the following table-valued function created against a SQL Server database with compatibility level 130 or 140: -- requires database compat 130 or 140 to ...
Joe Obbish's user avatar
  • 33.3k
3 votes
1 answer
1k views

A legacy application has a nightly job that repeatedly calls some store procedure using a TVP and passes in batches of 10,000 ids that are in sequential order that it needs to process. Now that the ...
Michael B's user avatar
  • 519
-1 votes
1 answer
62 views

CREATE PROCEDURE [dbo].[GetFruitName] ( @quantity int ) AS BEGIN SET NOCOUNT ON; INSERT INTO Table1(fname,fprice,quantity) SELECT f.name,f.price from ...
shivraj Jacky's user avatar
1 vote
1 answer
3k views

I have a stored procedure that calls an external script via a SQL Server language extension. I would like for my stored procedure to use a caller supplied table valued parameter (TVP) to then submit ...
user4321's user avatar
  • 215
6 votes
1 answer
374 views

Is there a best practice or strategy for table types used in TVPs? For instance, given the following: CREATE TABLE dbo.Colors ( Id int identity PRIMARY KEY, Name nvarchar(100), ); CREATE ...
Daniel Liuzzi's user avatar
1 vote
1 answer
3k views

some time ago I was developing a simple procedure to get the database sizes on a particular server. Here it is the procedure: USE MASTER GO ALTER PROCEDURE dbo.sp_getDBSpace @Radhe sysname=null, ...
Marcello Miorelli's user avatar
0 votes
3 answers
159 views

I've made a stored procedure to get all results which match specific students and objectives. CREATE PROCEDURE [dbo].[GetResults] @students [IdList] READONLY, @objectives [IdList] READONLY AS SELECT ...
James's user avatar
  • 103
4 votes
1 answer
5k views

As part of a manual replication process between databases with different but related schemas, for each table, we identify new and modified records in the source database and feed them via a table ...
Edward Brey's user avatar
-1 votes
1 answer
84 views

I need to write a Table - valued function from which I can acquire a table result set with different structure each time. another thing is that I need to declare variables inside my function . I've ...
user avatar

15 30 50 per page