你好我有问题
declare @target_date datetime
set @target_date=GETDATE();
insert into table1 ([column1],[column2],[column3])
(select [column1],[column2] from table2 where id=@id), @target_date
我怎么解决这个问题
Insert
Table1.Column1 = Table2.Column1
Table1.Column2 =是table2.column2
Table1.Column3=@target_date
2 回答
只需将变量设为计算列的值即可
插入后你不需要()for select命令,你必须在select命令中移动@target_date .