Ver Mensaje Individual
  #3  
Antiguo 15-06-2012
Avatar de Jere_84
Jere_84 Jere_84 is offline
Miembro
NULL
 
Registrado: sep 2011
Ubicación: Córdoba, Argentina
Posts: 214
Reputación: 0
Jere_84 cantidad desconocida en este momento
Código:

Código Delphi [-]
var
  oQTempCamposIndices : TSQLQuery;
  vCampos: string;
//....
begin
  oQTempCamposIndices := TSQLQuery.Create(nil);
  oQTempCamposIndices.SQLConnection:= SQLDataset.SQLConnection;
       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;
          //First;
          if oQTempCamposIndices.RecordCount > 1 then <------- ERROR: El nombre de objeto sys.columns no es valido.
          begin
            First;
            while not eof do
              vCampos := vCampos + sc.Trim(oQTempCamposIndices.Fieldbyname('Campo').AsString) + ';';
              next;
          end
          else
            vCampos := vCampos + sc.Trim(oQTempCamposIndices.Fieldbyname('Campo').AsString);
        end;

Última edición por Jere_84 fecha: 15-06-2012 a las 16:13:51. Razón: no toma el codigo fuente
Responder Con Cita