A
A
Alexander Andropov2020-04-03 13:58:57
Delphi
Alexander Andropov, 2020-04-03 13:58:57

How to add a column (field) to several tables at once?

Good day. I have 7 tables, I need to add the same field to all 7 tables, can I somehow do this with one command or action?

Thank you !

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
krka92, 2019-10-02
@krka92

It was the kerning

K
Konstantin Tsvetkov, 2019-09-25
@tsklab

You can use TRichEdit.
Or using DrawCellTextOut, output to TDBGrid like this:5d8b61d20c9f5186777657.png

procedure TAlbumDetailFR.grReleaseDrawColumnCell(Sender: TObject; const Rect: TRect; 
                                       DataCol: Integer; Column: TColumnEh; State: TGridDrawState);
  var iLeft: Integer;
begin
  case DataCol of
    0:  with grRelease.Canvas do begin
          FillRect( Rect );
          iLeft := 2;
          DrawCellTextOut( TDBGridEh(Sender).Canvas, Rect, iLeft, taReleaseYear.Value + ' ' );
          Font.Style := [fsBold];
          DrawCellTextOut( TDBGridEh(Sender).Canvas, Rect, iLeft, taReleaseNumber.Value + ' ' );
          Font.Style := [];
          DrawCellTextOut( TDBGridEh(Sender).Canvas, Rect, iLeft, taReleaseFirmName.Value );
        end;
  end;
end;

Procedure DrawCellTextOut:
procedure DrawCellTextOut( Canvas: TCanvas; const Rect: TRect; var Left: Integer; Text: String );
begin
  with Canvas do begin
    if ( Length( Trim( Text )) > 0 )
                          and (( Rect.Right - Rect.Left - Left ) > ( TextWidth('…') + 1)) then begin
      while (( TextWidth( Text ) + 1 ) > ( Rect.Right - Rect.Left - Left ))
        do Text := Copy( Text, 1, Length( Text ) - 2) + '…';
      TextOut( Rect.Left + Left, Rect.Top + 1, Text );
      Inc( Left, TextWidth( Text ) + 1);
    end;
  end;
end;

M
Maxim, 2020-04-03
@LongOf

ALTER TABLE ...;
ALTER TABLE ...;
ALTER TABLE ...;
ALTER TABLE ...;
ALTER TABLE ...;
ALTER TABLE ...;
ALTER TABLE ...;

launched by one script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question