菜鸟求教存储过程写法?
以下语句中在VFP中这么写,菜鸟想写个存储过程,请教大侠们:Select xm,zbjt,gzje From &lc子表名称 Where 0=1 Into Cursor v_xm &&&&字段(姓名,职补津贴,实发金额)
xm_记录=0
For i=1 To Getwordcount(lcxm,",") &&&lcxm,lczbjt,lcgzje各存在多个以','隔开的相对值;
lc_xm=Getwordnum(lcxm,i,",")
lc_zbjt=Getwordnum(lczbjt,i,",")
lc_gzje=Getwordnum(lcgzje,i,",")
Select v_xm
Locate For Alltrim(xm)==lc_xm &&&查找姓名字段中是否存在相同姓名的值,若有,就直接加实发金额,没有,就得插入行并为三个字段赋值
If !Found()
Append Blank
Replace xm With lc_xm,zbjt With lczbjt,gzje With lc_gzje
xm_记录=xm_记录+1
Else
Replace gzje With Alltrim(Str(Val(gzje)+Val(lc_gzje),10,1))
Endif
Endfor
在sql(2005)存储过程中怎么写?
[此贴子已经被作者于2017-11-5 10:24编辑过]