我不知道这个存储过程我写的对不对?
create procedure Pro_UpdatePrice @IntelID nvarchar (50),@HighPrice Type_Money,@LowPrice Type_Money,@NewPrice Type_Money with Encryption as
if exists (select * from pjjg_d where nbm_c=@intelid)
update pjjg_d set zgjj_m=@highprice,zdjj_m=@lowprice,zxjj_m=@newprice where nbm_c=@intelid
else
insert into pjjg_d(nbm_c,zxjj_m,zgjj_m,zdjj_m) values(@intelid,@newprice,@highprice,@lowprice)
我的想法是先根据nbm_c字段找记录,如果找到了就更新这条记录的3个字段,没找到则新增一条记录,不知道我这样写对不对?