output存储一列

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
alter PROCEDURE [dbo].[xmk_insert]
@rowid nvarchar(50),
@qyname nvarchar(200) output,
@dcode nvarchar(200) output
AS
BEGIN
DECLARE @rowcount int

/*if NOT exists(select * from bm_qyregion a inner join (select * from bs_jbxx where id=@rowid) b on a.qyname=b.qymc where a.del=0 )
begin
insert into bm_qyregion(qyname,ccode)
select qymc,case when len(dcode)>4 then SubString(dcode,0,5) else dcode end from bs_jbxx where id=@rowid
end*/


select @rowcount =count(*)from bm_qyregion a inner join (select * from bs_jbxx where id=@rowid) b on a.qyname=b.qymc
select @qyname =qymc,@dcode=dcode from bs_jbxx where id=@rowid
select * from bs_jbxx where id=@rowid
if(@rowcount=0)
begin
insert into bm_qyregion(qyname,ccode) values(@qyname,@dcode)
End
end

 

posted @ 2015-06-04 08:51  KainJC  阅读(119)  评论(0编辑  收藏  举报