I have a database that holds common functions that I use across multiple databases. One of these functions takes in a table as a parameter which is a user defined TYPE. I would like to know if there is a way to call this function from another database.
I tried to define the type in the other database like so:
DECLARE @bits as Common.dbo.Bits
However I received an error too many prefixes
I have tried adding the TYPE to each database, and then passing a table of that type to the function in the common database, but there I get an error of
Operand type clash: Bits is incompatible with Bits
You can't. Even if you declare the type identically in two databases, they're not treated the same. And the DECLARE
statement is only allowed a schema name and an object name, so there's no way to reference a type from another database.
See also this question for some possible work arounds (if you control both databases involved)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With