Getting the follow error for each column (note, both tables have the same column names, but I am not sure how to prefix the table data type)
Msg 209, Level 16, State 1, Procedure InsertNonExistingNode, Line 21 Ambiguous column name 'NodeTypeId'.
USE NWatchEntitiesUnitTest
GO
CREATE PROCEDURE InsertNonExistingNode (@TableVariable dbo.NodeTableType READONLY,
@ScalarParameter nvarchar(255))
AS
BEGIN
INSERT INTO NWatchNodes WITH (ROWLOCK) (
NodeTypeId,
Location,
DisplayName,
AccessLevel,
IsEnabled,
CreatedOn,
CreatedBy,
ModifiedOn,
ModifiedBy,
NativeId,
SourceId,
Name,
Alias)
SELECT
NodeTypeId,
Name,
Location,
DisplayName,
AccessLevel,
IsEnabled,
CreatedOn,
CreatedBy,
ModifiedOn,
ModifiedBy,
NativeId,
SourceId,
Alias
FROM @TableVariable t
/*Left Join then where ID is null to make sure the record doesn't exists*/
LEFT JOIN NWatchNodes PR WITH (NOLOCK)
ON PR.ID = @ScalarParameter
AND PR.Name = t.Name
WHERE PR.ID IS NULL
END
GO