Hi all,
I just started learning the SQL Server Indexes in SQL Server 2012 Management Studio (SSMS2012). I read some tutorials from the websites of Microsoft MSDN and sqlservercentral. I did 3 sets of basic sql codes of creating NonClusterIndex, ClusterIndex and UniqueIndex (Microsoft msdn examples) successfully. From the sqlservercentral website, I read an article "Stairway to SQL Server Indexes: Level 1, Introduction to Indexes", written by David Durant (dated: 2011/01/26) and tried to execute the following code (copied from the article):
-- Indexing Stairway; Level 1 code USE AdventureWorks GO IF db_name() <> 'AdventureWorks' RAISERROR('Database AdventureWorks not found', 22, -1) with log; GO --*** --*** Batch 1. --*** SET statistics io on SET statistics time on GO --*** --*** Ensure that the FullName index does --*** not exist when testing begins. --*** IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = object_id('Person.Contact') AND name = 'FullName') DROP INDEX Person.Contact.FullName; --*** Batch 2. --*** --*** Run the query (without index). --*** SELECT * FROM Person.Contact WHERE FirstName = 'Helen' AND LastName = 'Meyer'; GO --*** Batch 3. --*** --*** Create the index. --*** CREATE INDEX FullName ON Person.Contact ( LastName, FirstName ); GO --*** Batch 4. --*** --*** Run the query (with index). --*** SELECT * FROM Person.Contact WHERE FirstName = 'Helen' AND LastName = 'Meyer'; GO --*** --*** End of script. --***
I got the following Messages:
SQL Server parse and compile time: CPU time = 3 ms, elapsed time = 3 ms. Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'sysidxstats'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. SQL Server Execution Times: CPU time = 0 ms, elapsed time = 0 ms. SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 0 ms. Msg 208, Level 16, State 1, Line 19 Invalid object name 'Person.Contact'. SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 0 ms. Msg 1088, Level 16, State 12, Line 8 Cannot find the object "Person.Contact" because it does not exist or you do not have permissions. SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 0 ms. SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 0 ms. Msg 208, Level 16, State 1, Line 8 Invalid object name 'Person.Contact'.
I have no ideas (i) what they mean, and (ii) why I got: Invalid object name 'Person.Contact' three times in the Messages. Please kindly help, advise and respond.
Thanks in advance,
Scott Chang