使用存储过程实现(MS-SQL): create procedure Text @ID int, @功能 varchar(20), @Other varhcar(50) as begin if exists(select * from Tabel1 where ID=@ID and 功能=@功能) update table1 set Other=@other where where ID=@ID and 功能=@功能 else insert into table1(ID,功能,other) values(@ID,@功能,@Other) end;然后在代码里调节器用过程就可以了
INSERT INTO MYTABLE (FIELD1,FIELD2..) VALUES(VALUE1,VALUE2...)
create procedure Text
@ID int,
@功能 varchar(20),
@Other varhcar(50)
as
begin
if exists(select * from Tabel1 where ID=@ID and 功能=@功能)
update table1 set Other=@other where where ID=@ID and 功能=@功能
else
insert into table1(ID,功能,other) values(@ID,@功能,@Other)
end;然后在代码里调节器用过程就可以了