I’m using SQL Server 2008.
How can I pass Table Valued parameter to a Stored procedure across different Databases, but same server?
Should I create the same table type in both databases?
Please, give an example or a link according to the problem.
Thanks for any kind of help.
In response to this comment (if I’m correct and that using TVPs between databases isn’t possible):
The purist approach would be to say that if both databases are working with the same data, they ought to be merged into a single database. The pragmatist realizes that this isn’t always possible – but since you can obviously change both the caller and callee, maybe just use a temp table that both stored procs know about.
You don’t pass the temp table between databases. A temp table is always stored in tempdb, and is accessible to your connection, so long as the connection is open and the temp table isn’t dropped.
So, you create the temp table in the caller:
And then in the callee: