select object_id('object') returns null

From: Carlos Souza (anonymous_at_discussions.microsoft.com)
Date: 06/07/04


Date: Mon, 7 Jun 2004 14:06:01 -0700

Hello

Im having a problem with some objects in some databases returning null when I use select object_id().
The example below shows one table from sysobjects. When I issued a query using select object_name(object_id) it works. But when I issued a querie using select object_id(object_name) I got a null for an answer.

Heres an example:

select name,id,xtype,status from sysobjects where name = 'CRE_CGA_GAR_CONTR_BKP'
                                                   id xtype status
-------------------------------------------------- ----------- ----- -----------
CRE_CGA_GAR_CONTR_BKP 1966630049 U 1610612736

select object_name(1966630049)
                                                                                                                                 
--------------------------------------------------------------------------------------------------------------------------------
CRE_CGA_GAR_CONTR_BKP

select object_id('CRE_CGA_GAR_CONTR_BKP')
            
-----------
NULL

Im runnig a SQL Server 64 bits active/passive cluster. Select @version returns
Microsoft SQL Server 2000 - 8.00.904 (Intel IA-64)
        Dec 26 2003 20:26:45
        Copyright (c) 1988-2003 Microsoft Corporation
        Enterprise Edition (64-bit) on Windows NT 5.2 (Build 3790: )

Any help would be apreciated.

Regards

Carlos Souza



Relevant Pages