开发者

Copy data from a table to another one has different structure

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, Detai开发者_运维问答l).

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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜