IgorMi (12/1/2013)
All options are true except this one"CREATE CLUSTERED INDEX IDX_A ON #temp1(i,a)"
You should correct your question.
Igor, you are correct and thank you for pointing it out. If you were to combine the index with the Order By, then column a would be sorted and the only option that would not "work" would be the one you noted. I would like to correct the question in stating "if you had the option to add only one and not multiples..." such as index and ORDER BY. The intent of the question is adding only one value from the list to order column 'a' not multiples. For example:
create table #temp1
(
i int identity(1,1),
a numeric(8,2) default '0'
)
CREATE CLUSTERED INDEX IDX_A ON #temp1(a)
insert into #temp1 (a)
select 1
union all
select '32'
union all
select 21
union all
select null
union all
select '0'
union all
select .5
union all
select NULL
union all
select '.5'
union all
select '32'
select i, cast((cast(#temp1.a as float) + 10) as varchar) from #temp1
drop table #temp1
Administers, how do I go about "fixing" the question once it is published?
To all that misunderstood the intent and the inadequate question, my apologies:ermm: