CASE 语法在存贮过程中怎用?
CASE 语法在存贮过程中怎用?
CREATE PROCEDURE qd_proaddcl
@cltable1 char(10)
as
case cltable1= 'yl11 '
insert into yl11 (pzhm,rq,sl) values (...)
case cltable1= 'yl12 '
insert into yl12(pzhm,rq,sl) values (...)
------解决方案--------------------改用IF吧
CREATE PROCEDURE qd_proaddcl
@cltable1 char(10)
as
If cltable1= 'yl11 '
insert into yl11 (pzhm,rq,sl) values (...)
Else If cltable1= 'yl12 '
insert into yl12(pzhm,rq,sl) values (...)