你的意思是喜欢
insert into Red(userId, Name, TemporaryAddress
select userId, Name, Address
from Green
where userId = @userId
或者
declare @userId int, @Name varchar(100), @address varchar(100)
select @userId = userId, @Name = Name, @address = Address from Green where userId = 12345
insert into Red (userId, Name, TemporaryAddress) values (@userId, @Name, @address)
或者是其他东西?
...您的问题不清楚您到底想做什么。您现有的代码是什么样的,它没有做什么您希望它做的事情?
编辑
另一种选择是在 Green 表上使用插入触发器。我不确定你是否想基本上匹配表格,但如果你这样做了,那么这就是如何做到这一点:
create trigger green_InsToRed_TRG on Green for insert as
insert into Red (UserId, Name, TemporaryAddress)
select UserId, Name, Address from inserted