我还是 SQL 的新手,所以通过学习来做到这一点。我想使用存储过程填充表。我的问题是如何调用该过程以便执行它并填充表格。到目前为止,我已经做到了。
ALTER proc [dbo].[MytestTableLoad]
@ID int,
@FirstName varchar,
As
Begin
Set nocount on;
merge dbo.MytestTable2 as target
using (select @ID, @FirstName,@LastName) as source (Id, FirstName, LastName)
on (target.Id=source.Id)
when not matched then
Insert (Id, FirstName, LastName)
values (@Id, @FirstName,@LastName)
;
END