Re: select object_id('object') returns null

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 06/07/04


Date: Mon, 7 Jun 2004 17:17:21 -0400

Who is the owner of the object?

-- 
http://www.aspfaq.com/
(Reverse address to reply.)
"Carlos Souza" <anonymous@discussions.microsoft.com> wrote in message
news:AEDF780E-4080-49EC-9BF1-9CC8676BC534@microsoft.com...
> 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