Invalid return value OBJECT_ID?

Microsoft SQL Server 2014 (SP2-CU1) (KB3178925) - 12.0.5511.0 (X64) August 19, 2016 14:32:30 Copyright (c) Microsoft Enterprise Edition (64-bit) on Windows NT 6.1 (Build 7601 : Service Pack 1) (Hypervisor)

since sp_UpdateStats doesn't actually exist, the request is:

SELECT OBJECT_ID('sp_UpdateStats')

returns value: -838816646

and

select * FROM sys.objects WHERE name='sp_UpdateStats'

returns 0 string ...

How can it be? Error in function OBJECT_ID?

EDIT

It’s good to know that ID -838816646 is sent from sys.sysobjects or sys.system_objects, but then the question is more accurate:

  • Why does the procedure appear in sys.sysobjects and sys.system_objects and not in sys.objects, which should be the new view that we should use?
+4
2

Master sysobjects view

select * FROM master.sys.sysobjects WHERE name='sp_UpdateStats'

: -838816646

+2

sys.all_objects .

SELECT *
FROM   sys.all_objects
WHERE  NAME = 'sp_UpdateStats' 

.

+1

Source: https://habr.com/ru/post/1660271/


All Articles