I have a user-defined table type in one database in SQL Server (let's call this DB1).
The definition for my type is very simple and just includes 2 columns. The script to create my type is below:
CREATE TYPE [dbo].[CustomList] AS TABLE
(
[ID] [int] ,
[Display] [NVARCHAR] (100)
)
I've also run the same script on another database, so my type is on 2 databases (Let's call the 2nd database DB2).
I now call a stored procedure in DB1 from my C# app passing in the parameter for my CustomList user-defined type.
The procedure in DB1 now needs to call a procedure on DB2 passing in this CustomList.
So, the procedure in DB1 looks like this:
ALTER PROCEDURE [dbo].[selectData]
@psCustomList CustomList ReadOnly
AS
BEGIN
EXEC DB2.dbo.selectMoreData @psCustomList
END
And the procedure in DB2 is like this (I've only show the parameter list as that's all that is needed):
ALTER PROCEDURE [dbo].[selectMoreData]
@psCustomList CustomList ReadOnly
AS
BEGIN
......
When I run this I receive the following error:
Operand type clash: CustomList is incompatible with CustomList
Anybody got any ideas what I'm doing wrong?
I'm using SQL Server 2008.
Thanks in advance