How to improve the code of stored procedure with inner join to possible empty tvp
问题 I want to improve the code of the following stored procedure. I want to join it into single select statement. Can you purpose a better way? CREATE PROCEDURE [dbo].[pr_FinDocument_Filter] @finDocIdForFilter [dbo].[GuidList] READONLY, @filteredSid nvarchar(64), @filteringOffsetInDay int AS BEGIN IF (@filteredSid is null or @filteringOffsetInDay is null) BEGIN RAISERROR(N'arguments must have a value', 15, 1); END IF EXISTS (SELECT 1 FROM @finDocIdForFilter) BEGIN SELECT fin_doc_extra.docId FROM