ALTER PROCEDURE [dbo].[Qf_LoginLog]
@Empid int ,
@areaid int,
@schoolid int=null,
@classid int=null,
@Content varchar(200)
AS
BEGIN
declare @allcontent varchar(200)
declare @mobile varchar(12)
if @areaid is not null and @schoolid is null and @classid is null
begin
select @mobile= mobile from jxt_mobile where left(areaid,4)=@areaid
set @allcontent='发送给'+@mobile+'内容:'+@Content
end
if @areaid is not null and @schoolid is not null and @classid is null
begin
select @mobile= mobile from jxt_mobile where schid=@schoolid
set @allcontent='发送给'+@mobile+'内容:'+@Content
end
if @classid is not null
begin
select @mobile =a.mobile from jxt_mobile a,jxt_class b where b.classid=@classid and a.schid=b.schid
set @allcontent='发送给'+@mobile+'内容:'+@Content
end
begin
set IDENTITY_INSERT dbo.Qf_Log on
insert into dbo.Qf_Log(id,Empid,LogContent,Logtime)
values (1,@Empid,@allcontent,getdate())
end
END 为什么执行这个存储过程 exec Qf_LoginLog 1618,1102,null,null,'测试消息,打扰了'明明有49条数据但是select * from dbo.Qf_Log order by logtime desc总是只能查到一条数据。这是怎么回事?
@Empid int ,
@areaid int,
@schoolid int=null,
@classid int=null,
@Content varchar(200)
AS
BEGIN
declare @allcontent varchar(200)
declare @mobile varchar(12)
if @areaid is not null and @schoolid is null and @classid is null
begin
select @mobile= mobile from jxt_mobile where left(areaid,4)=@areaid
set @allcontent='发送给'+@mobile+'内容:'+@Content
end
if @areaid is not null and @schoolid is not null and @classid is null
begin
select @mobile= mobile from jxt_mobile where schid=@schoolid
set @allcontent='发送给'+@mobile+'内容:'+@Content
end
if @classid is not null
begin
select @mobile =a.mobile from jxt_mobile a,jxt_class b where b.classid=@classid and a.schid=b.schid
set @allcontent='发送给'+@mobile+'内容:'+@Content
end
begin
set IDENTITY_INSERT dbo.Qf_Log on
insert into dbo.Qf_Log(id,Empid,LogContent,Logtime)
values (1,@Empid,@allcontent,getdate())
end
END 为什么执行这个存储过程 exec Qf_LoginLog 1618,1102,null,null,'测试消息,打扰了'明明有49条数据但是select * from dbo.Qf_Log order by logtime desc总是只能查到一条数据。这是怎么回事?
values (1,@Empid,@allcontent,getdate()) 你这里明明只插入了一次,怎么会有49条