Working with table types

I created a table value type that is created perfectly.

CREATE TYPE [ContactTemplate] AS TABLE ( [Email] VARCHAR(100), [FirstName] VARCHAR(50), [LastName] VARCHAR(50) ) GO 

Then, when I try to create a procedure:

 CREATE PROCEDURE [dbo].[usp_ProcessContact] ( @Email VARCHAR(100), @FirstName VARCHAR(50), @LastName VARCHAR(50), @Contact ContactTemplate READONLY) as Begin ------- End 

I keep getting error when

 @Contact ContactTemplate READONLY" The parameter @Contact cannot be declared READONLY since it is not a table valued parameter 

I tried a lot of things, removing dbo , brackets, etc., but still can't get it to work. Help me please.

+4
source share
1 answer

Try this: Edit -> IntelliSense -> Refresh Local Cache. If you have just defined a table type, your character table does not yet know this. Or create a type, exit SSMS and run again.

+10
source

Source: https://habr.com/ru/post/1486527/


All Articles