Reputation: 2022
I'm trying to call IDENT_CURRENT()
against a different database without moving to that database but I can't seem to find the schema it belongs to. I tried both sys
and dbo
but neither worked. I've searched and searched but nowhere can I find anything relating to either it's schema or how to call it.
How do you go about running such functions on another database please? I know I can most likely create a function in that database and then call my function but I'm first trying to find out whether there's an easier way.
Thanks!
Upvotes: 0
Views: 461
Reputation: 82524
IDENT_CURRENT
is a function, it doesn't belong to a schema.
You can provide it with a 3-parts identifier to a table that belongs on a different database in the same server:
SELECT IDENT_CURRENT('<Database>.<Schema>.<Table>');
However you should note that ident_current
might yield wrong results.
For more information, read Aaron Bertrand's For the last time, NO, you can't trust IDENT_CURRENT().
Upvotes: 2