我有一个检索数据的存储过程,该过程以字符串形式获取2个参数。
每次使用新参数多次调用此过程。
我想调用该过程一次,并将所有参数作为参数列表发送。
这就是我试过的
create type dbo.adressAndCity as table
(
[adress] string,
[city] string
)
go
create procedure dbo.selectItems
(
@Items adressAndCity readonly
)
as
begin
select *
from dbo.testTable
// the syntax below is nOt correct
where adress = (@Items.adress) And city = (@Items. city)
end
如何访问参数表中的值?
答案 0 :(得分:0)
我相信您正在寻找JOIN
:
create procedure dbo.selectItems
(
@Items addressAndCity readonly
)
as
begin
select T.* from dbo.testTable T
INNER JOIN @Items I
ON T.address = i.address)
And T.city = I.city)
end
请注意,我已更正address