I use the “OBJECT_NAME’ function in conjunction with systems tables to return the names of objects given their object_id. Up until yesterday, this worked fine. When I use the same function now, I get a null value in the column that is supposed to return the object name. I tried reconnecting to the server and trying the function on different DBs, but I am getting the same results. Does anyone know why this would occur?
I use the OBJECT_NAME’ function in conjunction with systems tables to return the names
Share
One possible problem is that you are in the wrong database. The “id” is database specific, so the real key is “, “.
This is more obvious if you do OBJECT_ID(). If you pass in a three-part name, then it will resolve in any database you are in. If you pass in a one-part name, then it tries to resolve it in the current database. If not found, you get NULL.