tags:

views:

50

answers:

1

I have two tables with different structure:

TableSource: intId(not null), txtSummary, strDetail

TableDesc: guidId(not null), guidFK(not null), Name, Detail

I want to migrate data from two fields of tableSource(txtSummary, strDetail) to two fields of tableDesc(Name, Detail).

guidId is auto generation and guidFK should be assigned to a fixed value.

I'v tried writing some t-sql code lines but not success. Could anyone help me?

A: 

Something like:

INSERT into TableDesc (Name, Detail)
SELECT txtSummary, strDetail
  FROM TableSource

should work, if the other fields are auto-generated on insert like you said. Which database is this using?

Coxy
May be you're right. But sorry, i can't suppose that guidFK is auto generation. It should be assigned to a value.
Kernel
@Kernel - what do you want to assign it? A GUID generated at insert time, or else some other fixed value?
Coxy

related questions