
use Employee;
declare @NameAndRole table
(
id int not null,
Name nchar(20),
birthday smalldatetime,
sex int,
honeyname nchar(30),
NowAddress nchar(50),
IsEmployee bit,
Identifier nchar(10)
)
Insert into @NameAndRole
select 1, null,'傻缺',2,Null,null,null,null
union all
select 10,null,'火星人',3,Null,null,null,null;
merge dbo.person as target
using
(select * from @NameAndRole) as source
on source.id=target.id
when matched
then update set target.sex=source.sex,target.name=source.name
when not matched by target
then insert values(source.sex,source.name)
when not matched by source
then delete;
请教问题原因
------解决思路----------------------
INSERT(指定列名)
------解决思路----------------------
Server 2008吗?smalldatetime字段类型可以赋值 字符串汉字吗??
