title: sql server table type clash operand
body: <p>I have a the same table type defined in two different database schemas. When I try to call a SP from one schema to another passing the type as parameter, I got the following error:</p>
  
  <blockquote>
    <p>"Operand type clash myCustomType is incompatible with myCustomType"</p>
  </blockquote>
  
  <p>I have the following Code:</p>
  
  <h3>Type Definition</h3>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TYPE myCustomType AS TABLE
  (
    somevalue INT, 
    somevalue2 INT
  );
  </code></pre>
  
  <h3>Stored Procedure Definition</h3>
  
  <pre class="lang-sql prettyprint-override"><code>USE DB1
  GO
  CREATE PROC1( 
    @myVar myCustomType READONLY
  )
  AS
  BEGIN
    EXEC db2.dbo.PROC2 @myVar
  END
  
  GO
  
  USE DB2
  GO
  CREATE PROC2( 
    @myVar myCustomType READONLY
  )
  AS
  BEGIN
    --do something with myVar  
  END
  </code></pre>
  
  <h3>Execution</h3>
  
  <pre class="lang-sql prettyprint-override"><code>USE db1
  GO
  DECLARE @myVar myCustomType
  INSERT into @myVar(1,2)
  EXEC PROC1 @myVar
  </code></pre>
  
  <p>How can I fix this problem?</p>