更新时间:2023-11-30 23:46:40
使用
IF EXISTS(SELECT * FROM @Words)
不是
IF @Words IS NOT NULL
表值参数将始终存在,并且不能像标量参数那样 NULL
.
The table valued parameter will always be present and can't be NULL
like a scalar parameter.
如果你调用 exec [dbo].[SearchByWord]
而不传递任何参数,结果是 @Words
将是空表.
If you call exec [dbo].[SearchByWord]
without passing anything for the parameter the result is that @Words
will be empty table.