with oQTempCamposIndices do
begin
SQL.Clear;
SQL.Add('Select Columnas.name as Campo From sys.columns as Columnas ');
SQL.Add('INNER JOIN sys.index_columns as ColIndices on ColIndices.object_id = Columnas.object_id ');
SQL.Add('AND ColIndices.column_id = Columnas.column_id ');
SQL.Add('INNER JOIN sys.indexes as Indices on Indices.object_id = ColIndices.object_id ');
SQL.Add('AND Indices.index_id = ColIndices.index_id ');
SQL.Add('Where Indices.name = ' + QuotedStr(Indice));
oQTempCamposIndices.Open;
if (not eof) then
begin
vCampos := vCampos + sc.Trim(oQTempCamposIndices.Fieldbyname('Campo').AsString) + ';';
next;
end
else
begin
vCampos := vCampos + sc.Trim(oQTempCamposIndices.Fieldbyname('Campo').AsString);
end;
end;