Declaring a scalar variable that its a table valued parameter? I get error 137 that I must declare a scalar variable (@facilities), although I'm declaring it in the Create stored procedure as a readonly variable, so I wasn't sure what I'm missing here. any advice will be appreciated.
I created a table valued parameter to hold multipple integer values, that I can call later in my stored procedure. the goal is to get all the documents implementing in each facility for the one division (6) for a specific date. Please see a section of the code below:

use DevDocMgt_new
CREATE TYPE dbo.Facilities AS TABLE
(FacilityID TINYINT PRIMARY KEY);
go

declare @F dbo.Facilities;
Insert @F Values (1), (2), (3), (4), (5);
go

Create PROCEDURE dbo.GetImpDocsTwo
(
@facilities dbo.Facilities ReadOnly,
@facilitydivisionID tinyint = 6)
AS
BEGIN
SET NOCOUNT ON; 
SELECT  di.DocumentNumber, di.DocumentVersion, di.DocumentTitle, 
        ts.TransmittalNumber, ts.TransmittalVersion,
        CASE WHEN TransmittalSiteLeadImpDate IS NOT NULL 
                  AND (TransmittalSiteLeadFacility = @facilities OR TransmittalSiteLeadFacility = @facilityDivisionID) 
             THEN TransmittalSiteLeadImpDate ELSE TransmittalImpDate END AS FacilityImpDate
FROM    dbo.DocumentInfo di
        INNER JOIN dbo.TransmittalSheet ts ON di.DocumentTransmittalImp = ts.TransmittalID
        LEFT OUTER JOIN dbo.TransmittalSiteLead tsl ON ts.TransmittalID = tsl.TransmittalSiteLeadTSID
        Inner Join @facilities as F on f.facilityID = tsl.TransmittalSiteLeadFacility

-- Select documents implementing in the facility
WHERE   (tsl.TransmittalSiteLeadFacility = @facilities OR 
         tsl.TransmittalSiteLeadFacility = @facilitydivisionID)
end
The problem is here:

WHERE   (tsl.TransmittalSiteLeadFacility = @facilities


You are trying to compare a column on the left to a table on the right. This is like saying:

FROM sys.objects
WHERE object_id = sys.columns


...which obviously makes no sense.

That where clause doesn't belong there at all. You've already ensured that the facilities listed in the incoming table-valued parameter are matched to TransmittalSheet by using it in the JOIN clause. There is no need to filter on that match again.

My guess after several rounds of teeth-pulling is you want this:

CREATE PROCEDURE dbo.GetImpDocsThree
  @facilities dbo.Facilities ReadOnly,
  @facilitydivisionID tinyint = 6
AS
BEGIN
  SET NOCOUNT ON; 

  ;WITH f AS
  (
    SELECT FacilityID FROM @faclities
    UNION ALL SELECT @facilitydivisionID
  ) 
  SELECT  di.DocumentNumber, di.DocumentVersion, di.DocumentTitle, 
    ts.TransmittalNumber, ts.TransmittalVersion,
    FacilityImpDate = COALESCE(ts.TransmittalSiteLeadImpDate, ts.TransmittalImpDate)
   FROM dbo.DocumentInfo AS di
   INNER JOIN dbo.TransmittalSheet AS ts 
     ON di.DocumentTransmittalImp = ts.TransmittalID
   INNER JOIN f 
     ON tsl.TransmittalSiteLeadFacility = f.FacilityID;
END
GO


Or just insert 6 into the TVP up front too, and ditch the additional single facility variable altogether.