且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从表A复制到表B.

更新时间:2023-02-03 16:01:58

尝试:

  INSERT   INTO  TableB  SELECT  *,GETDATE() FROM  TableA 



一个非常简单的谷歌会找到你这个: http://www.w3schools.com/sql/sql_insert_into_select.asp [ ^ ]

>

Dear expert,


1. Want to copy from TABLE A TO TABLE B in a stored procedure in MS SQL SERVER 2008.

table B is a replica of table A.


2. Need to append the period the following

a. The Month
b. The Year
c. The Date


should be appended to the copied table to Table B.


How do you accomplish the above .

Thanks

Try:
INSERT INTO TableB SELECT *, GETDATE() FROM TableA


A very simple google would have found you this: http://www.w3schools.com/sql/sql_insert_into_select.asp[^]