J. Davidson
J. Davidson

Reputation: 3317

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..

Upvotes: 4

Views: 2441

Answers (1)

Meredith Poor
Meredith Poor

Reputation: 351

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.

Upvotes: 12

Related Questions