Inquiridor
sysobjects e sysindexes

Pergunta
-
Pessoal,
Estou trabalhando com SQL Server 2000
Rodei as seguintes consultas:
select name, id, indid, rowcnt, reserved, used from sysindexes where name like 'arrumar_num_parcela'
select name, id, xtype, status, crdate from sysobjects where name like 'arrumar_num_parcela'
select * from arrumar_num_parcela
No resultado o select na tabela não foi possível pois não existe, mas como não existe se está nas tabelas de sistema?
name id indid rowcnt reserved used
----------------------------------------------------------------------------------------------- ----------- ------ -------------------- ----------- -----------
arrumar_num_parcela 1271417 0 1203 13 10
(1 row(s) affected)
name id xtype status crdate
------------------------------------------------------------------------------------------------ ----------- ----- ----------- -----------------------
arrumar_num_parcela 1271417 U 1610612736 2010-10-29 17:15:59.503
(1 row(s) affected)
Msg 208, Level 16, State 1, Line 1
Invalid object name 'arrumar_num_parcela'.
Todas as Respostas
-
Douglas,
Voce não consegue dar select em um indice portanto o seu ultimo select da erro, esse objeto (arrumar_num_parcela) é um indice e não uma tabela. Veja:
--Table creation CREATE TABLE ObjetoForum ( Id INT ) --Index creation CREATE INDEX IndiceObjetoForum ON ObjetoForum(Id) --Selects select name, id, indid, rowcnt, reserved, used from sysindexes where name like 'IndiceObjetoForum' select name, id, xtype, status, crdate from sysobjects where name like 'IndiceObjetoForum' select * from IndiceObjetoForum --> Erro pois estamos pesquisando por um indice select name, id, indid, rowcnt, reserved, used from sysindexes where name like 'ObjetoForum' select name, id, xtype, status, crdate from sysobjects where name like 'ObjetoForum' select * from ObjetoForum --> Sucesso, pois é uma tabela
Tambem feito no SQL 2k
Fabrizzio A. Caputo
MCT
Certificações:
Oracle OCA 11g
MCITP SQL Server 2008 Implementation and Maintenance
MCITP SQL Server 2008 Developer
ITIL V3 Foundation
Blog Pessoal: www.fabrizziocaputo.wordpress.com
Email: fabrizzio.antoniaci@gmail.com- Editado Fabrizzio CaputoModerator quarta-feira, 22 de maio de 2013 16:09
-
-
Douglas,
Realmente é, execute este comando e poste um print com o resultado:
EXEC SP_HELP 'arrumar_num_parcela'
Fabrizzio A. Caputo
MCT
Certificações:
Oracle OCA 11g
MCITP SQL Server 2008 Implementation and Maintenance
MCITP SQL Server 2008 Developer
ITIL V3 Foundation
Blog Pessoal: www.fabrizziocaputo.wordpress.com
Email: fabrizzio.antoniaci@gmail.com -
Fabrizio,
Executei os comandos abaixo e estou intrigado pelo objeto não existir.
exec sp_help 'arrumar_num_parcela'
exec sp_helpindex 'arrumar_num_parcela'
Msg 15009, Level 16, State 1, Procedure sp_help, Line 71
The object 'arrumar_num_parcela' does not exist in database 'dbecomm'.
Msg 15009, Level 16, State 1, Procedure sp_helpindex, Line 30
The object 'arrumar_num_parcela' does not exist in database 'dbecomm'.