Invalid column name for table type parameter

Simsons

I have a table type which is used in a stored procedure to filter out values.

CREATE TYPE PackageIdType AS TABLE   
( 
     PackageId VARCHAR(150)  
);  

My stored procedure is this:

CREATE PROCEDURE [dbo].[spLocalGetValuesFromTable]    
     @RundateStart datetime,
     @RundateEnd datetime,
     @CreationIds PackageIdType READONLY  
AS
     SELECT * 
     FROM MYTABLE 
     WHERE date BETWEEN @RundateStart AND @RundateEnd 
       AND Ids IN (@CreationIds)

But when I run this getting error:

Msg 207, Level 16, State 1, Procedure spLocalGetValuesFromTable, Line --[Batch Start Line 0]
Invalid column name '@CreationIds'

cf_en

It's a table, so the correct syntax would be

SELECT *
FROM  MYTABLE
WHERE date Between @RundateStart And @RundateEnd 
  AND Ids in (SELECT PackageId FROM @CreationIds)

This assumes that each row in the table @CreationIds is an Id that can map to the same type as Ids in MYTABLE.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Getting invalid column name using a pivot table

From Dev

Getting invalid column name using a pivot table

From Dev

no column was specified for column [x] of [table] and invalid column name

From Dev

Uncaught error: Invalid type for google table column

From Dev

Column Name of PL/SQL Table-Type

From Dev

EF Mapping Table Error "Invalid column name XXX_Id"

From Dev

Entity Framework Invalid column name when adding property that is not in db table

From Dev

Invalid Column Name *Id

From Dev

Invalid column name 'ProposalTypeID'

From Dev

Invalid column name (JDBC)

From Dev

"Invalid column name" ORDER BY

From Dev

invalid Column Name

From Dev

Error: Invalid column name

From Dev

Table name as PostgreSQL function parameter / ERROR: column ".." does not exist

From Dev

Invalid Column name while column is there

From Dev

Invalid Column name while column is there

From Dev

SQL Server Table Valued Parameter column is not supported. The type is 'Object'

From Dev

Is "arguments" an invalid parameter name in JavaScript?

From Dev

Msg 207 Invalid column name $node_id for pseudo column in inline table valued function

From Dev

Qt/SQL - Get column type and name from table without record

From Dev

Qt/SQL - Get column type and name from table without record

From Dev

Passing a Table name as a parameter

From Dev

MySQL table name as parameter

From Dev

Entity framework : Invalid column name

From Dev

Invalid Column Name in Select Statement

From Java

SQL Server: Invalid Column Name

From Dev

TSQL - Invalid Column Name RowNumber

From Dev

Invalid column name error on query?

From Dev

MS SQL Invalid Column Name

Related Related

HotTag

Archive