Oscar
Oscar

Reputation: 1

What does "INDEX = PK_DPAGODOCUMENTO" means in this sql query

I'm stuck with this query that was left by another programmer. I searched and searched, but I still have no clue. If someone could guide me, I would really appreciate it.

The query says

SELECT ... 
FROM dbo.DPAGODOCUMENTO AS T2 (INDEX=PK_DPAGODOCUMENTO) 
RIGHT OUTER JOIN dbo.MDOCUMENTO ... WHERE ...

where PK_DPAGODOCUMENTO is a CONSTRAINT [PK_DPAGODOCUMENTO] PRIMARY KEY CLUSTERED on the table [DPAGODOCUMENTO].

What does (INDEX=PK_DPAGODOCUMENTO) really mean, and what does it do? We are using MSSQL 2005.

Upvotes: 0

Views: 42

Answers (1)

ughai
ughai

Reputation: 9890

It's a Table Level Query Hint to override the default behaviour of SQL Server query optimizer and nudge it to use a specific index (PK_DPAGODOCUMENTO which is the Clustered Index in this case).

Upvotes: 1

Related Questions