Skip to content
This repository has been archived by the owner on May 10, 2020. It is now read-only.

Table Valued Paramters #106

Open
klmallory opened this issue Oct 29, 2019 · 0 comments
Open

Table Valued Paramters #106

klmallory opened this issue Oct 29, 2019 · 0 comments

Comments

@klmallory
Copy link

I work in a security and performance sensitive environment. Access to data is limited to server side SQL Stored procedures. Dynamically constructing "where" clauses with multiple Ids is not a possibility. In order to keep our procedures performing optimally we discourage repeat trips for requests for results with lists of Ids. Executing it in SQL looks like:

DECLARE @ids [dbo].[MyUserDefinedTableType]
INSERT INTO @ids (ID)
Values (1234),(2345),(9876)

EXEC [dbo].[myProc] @ids
(
@idlist [dbo].[MyUserDefinedTableType] readonly
)
AS
select Name
from [dbo].Users u
join @idlist p on p.Id = u.UserId

In ODBC this should be possible, but, Table Value Parameters can be of user defined type with multiple columns.

ODBC 7.3 and above does support this data type:
https://docs.microsoft.com/en-us/sql/relational-databases/native-client-odbc-how-to/use-table-valued-parameters-odbc?view=sql-server-ver15

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-tds/c264db71-c1ec-4fe8-b5ef-19d54b1e6566

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants