简体   繁体   中英

Copy data from one table to another when column sizes are different

I have two tables t1 (old) with 4 columns and t2 (new table) with 6 columns.

I want to copy the data from t1 to t2 with date and 'ÝES' as default values in T2 as these values are not available in T1.

  • T1 - 4 columns (c1, c2, c3, c4)
  • T2 - 6 columns (c1, c2, c3, c4, getdate(), 'ÝES') like I need

Please help me with this.

这应该得到期望的结果:

insert into T2 (c1,c2,c3,c4,c5,c6) select c1,c2,c3,c4,sysdate, 'ÝES' from T1;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM