title: How to determine the SQL Server object name from object id and database id?
body: <p>I need the behaviour of SQL Server 2005 where function OBJECT_NAME takes two arguments, <code>obj id</code> and <code>db id</code>, while SQL Server 2000 takes only <code>obj id</code> so the execution must be in the context of the database to which inspected object belongs to. </p>
  
  <p>Solution must be possible to implement in a function, so it can be used in a select query.</p>