.net - PostgreSQL equivalent to SQL Server's TVP -
sql server has table value parameters allows pass array of values parameter.
what appropiate way achieve similar postgresql query can like:
select * product id in ($1)
i'm using npgsql .net library.
in postgresql can use arrays instead of list of ids like:
... id = any('{1, 2, 3}'::int[])
or
... id = any(array[1, 2, 3])
which means id
1 of array's items.
read more arrays operators , functions.
to pass array parameter third party languages can use @ least first variant:
... id = any($1 ::int[])
where $1 string parameter looks {1, 2, 3}
. note space between $1
, ::int[]
- may necessary clients.
not sure c# supports array parameters directly.
Comments
Post a Comment