这是变量的声明方式:
CREATE FUNCTION Fn_custom_roomie_emails
(@htenant NUMERIC(18),
@dtmoveout DATETIME,
@lesseeonly VARCHAR(3)= 'NO',
@relationship VARCHAR(100),
@listseparator VARCHAR(10) = '; ',
@nameseperator VARCHAR(10) = ', ',
@andfunction VARCHAR(3) = 'NO',
@tenantemail VARCHAR(100) = '')
当我以这种方式执行时,该功能正常工作:
exec dbo.Fn_custom_roomie_emails(hmy, Getdate(), 'All', **'Roommate'**, ';', ' ', '', 'YES')
但现在我想传递多个关系,如下所示:
exec dbo.Fn_custom_roomie_emails(hmy, Getdate(), 'All', **'Roommate', 'Guarantor'**, ';', ' ', '', 'YES')
那我怎么能这样做呢?
答案 0 :(得分:0)
像Giorgos所说的Table-Valued Parameter.you可以像这样声明
declare @relationship table (relationship varchar(100))
INSERT INTO @relationship(relationship) values('Roommate');