2

I have the same table type in two databases (DB1 and DB2), DB1 has an stored proc (sp1) which has the above type as an input parameter.

Now, I want invoke this SP from DB2.

But, I am getting this error:

Msg 206, Level 16, State 2, Procedure sp1, Line 0
Operand type clash: t1 is incompatible with t1

How do I do this? Is there any work around for this?

Here is the script for the same.

--setup starts

Create database DB1
go

create database db2
go

use DB1
GO

create type t1 as table(id int)
go

use DB2
GO

create type t1 as table(id int)
go

use DB1
go

create proc sp1 (@p1 t1 readonly)
as
select * from @p1
GO

--script start

use DB2
GO

declare @p t1

insert into @p values(1)
insert into @p values(2)
insert into @p values(3)
exec DB1.dbo.sp1 @p
GO

--clean up

use master
go
drop database DB1
go

drop database db2
go

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.