Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working with table types

I have created a Table Value Type, which is created fine.

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 at

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

I have tried many things, removing dbo, brackets etc., still cant get it to work. Help please..

like image 698
J. Davidson Avatar asked Dec 15 '22 09:12

J. Davidson


1 Answers

Try this: Edit -> IntelliSense -> Refresh Local Cache -- If you just defined the table type, your symbol table doesn't know it yet. Or, create the type, exit from SSMS, and reopen.

like image 129
Meredith Poor Avatar answered Dec 26 '22 10:12

Meredith Poor