I have this variable table
declare @mapping table (
the_row int
, Company smallint
, Branch smallint
, Flag bit
index aa clustered (Company, Branch)
, index bb nonclustered (Flag)
)
It seems that I cannot use table hints like this
select *
from @mapping mapping with(index=[aa])
or
select *
from @mapping mapping with(index=[bb])
It complains with
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Is another way to use different index depending on the use case?