I'm passing a table valued parameter to a stored procedure to use in a where clause, but I want to check whether the parameter has been passed-in or not first. What is the best way to check a parameter of this type? For example, I want the select to be along the lines of:
SELECT *
FROM tableName
WHERE
@TVP IS NULL OR RecordID IN (SELECT * FROM @TVP)
WHERE dbo.tableName IS NULLso tryWHERE NOT EXISTS (SELECT 1 FROM @TVP). Also you should name the column instead of saying*.