Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Copying data from a FIELD/TABLE to another FIELD/TABLE.

Copying data from a FIELD/TABLE to another FIELD/TABLE.

Copying data from a FIELD/TABLE to another FIELD/TABLE.


I use Interbase 6 SQLServer in conjunction with Delphi 6 Enterprise.

I need to copy the data from (field) P_NO in (table) PARENT into (field) P_NO in
(table) TRNSFR.

Can someone please tell me how to do this?

I might mention the following:

I have a 3-Tier application with a DataBase (PCHILD.gdb ecapsulating tables PARENT
(with fields P_NO PNAME and C_NO) and table TRNSFR with the same fields. I also have an
IB6 ApplicationServer in place and running.

In the ThinClient I have a DataModule wherein I access the DataBase using (interalia)
TIBDataSet (IBFatherDataSet), TDataSource (dsFather), TIBDataSet (IBdsTrnsfr),
TDataSource (dsTrnsfr).

ModifySQL Property on IBdsTrnsfr is set to default:


In my effort to create what I need I have an IBFatherDataSet AfterScroll Event:

procedure TParentDM.IBFatherDataSetAfterScroll(DataSet: TDataSet);
  IBFatherDataSet.ModifySQL.Text := 'UpdateTRNSFR + set + P_NO =:PARENTP_NO';

The project compiles but during RUNTIME UponCreate (of the DataModule) the above procedure
(being triggered thereby) causes only the FIRST record in PARENT to display in a grid
along with the values in P_NO and C_NO - but the PNAME field merely displays a single-pipe

RE: Copying data from a FIELD/TABLE to another FIELD/TABLE.

This forum is about Mimer SQL.

I think SQL Server supports statements like this

insert into table1
select columnlist
from table 2
where somecondition;

This is for creating new rows. Updating existent rows with different values is not that easy.

1) create a stored function that calculates the value and do

update table1
set    column1 = calculatevalue(column2)
where  somecondition;

2) create a file with the updates needed

select 'update table1 set column1 = ' || t2.value || ' where id = ' || t1.id
from   table1 t1, table2 t2
where  t1.id = t2.id;

This will print a lot of update commands on the screen. Cut and paste them and run

RE: Copying data from a FIELD/TABLE to another FIELD/TABLE.

Case closed.

Thanks for your suggestion.

But after two weeks of attendance at the "School of head-banging" I have discovered the following is what is required.

procedure TParentDM.IBFatherDataSetAfterScroll(DataSet: TDataSet);
  IBdsTrnsfr.Active := True;
  if IBdsTrnsfr.state in dsEditModes then
  if IBdsTrnsfrP_NO.value = 0 then
    IBdsTrnsfrP_NO.value := 1
    IBdsTrnsfrP_NO.value := IBdsChildP_NO.value;

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close