set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
--exec deleteSignLog 110, ‘3|4‘
ALTER proc [dbo].[deleteSignLog]
@lngArcId int, --文章内码
@lstUserIds nvarchar(max) --选择的用户内码 3|4
as
set nocount on
select arc_id, sign_time, sign_content, sign_manager_id, status into #Temp01 from dt_sign_log where arc_id = @lngArcId
select a into #Temp from dbo.split(@lstUserIds,‘|‘)
delete from dt_sign_log where arc_id = @lngArcId
insert into dt_sign_log
select
@lngArcId,
isnull(b.sign_time,getdate()),
isnull(b.sign_content,‘‘),
a.a,
isnull(b.status,0)
from #Temp a
left join #Temp01 b on b.arc_id = @lngArcId and b.sign_manager_id = a.a
drop table #Temp
drop table #Temp01
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER function [dbo].[split](@SourceSql varchar(8000),@StrSeprate varchar(10))
returns @temp table(a varchar(100))
as
begin
declare @i int
set @SourceSql=rtrim(ltrim(@SourceSql))
set @i=charindex(@StrSeprate,@SourceSql)
while @i>=1
begin
insert @temp values(left(@SourceSql,@i-1))
set @SourceSql=substring(@SourceSql,@i+1,len(@SourceSql)-@i)
set @i=charindex(@StrSeprate,@SourceSql)
end
if @SourceSql<>‘\‘
insert @temp values(@SourceSql)
return
end
#region 执行一条存储过程 删除sign_logo中的记录
public static void deleteSign_Log(int arc_id, string userss)
{
using (SqlConnection cOnn= new SqlConnection(DbHelperSQL.connectionString))
{
conn.Open();
try
{
SqlCommand comm = new SqlCommand("deleteSignLog", conn);
comm.Parameters.Add(new SqlParameter("@lngArcId", SqlDbType.Int)).Value = arc_id;
comm.Parameters.Add(new SqlParameter("@lstUserIds", SqlDbType.NVarChar, 1000)).Value = userss;
comm.CommandType = CommandType.StoredProcedure;
comm.ExecuteNonQuery();
conn.Close();
conn.Dispose();
comm.Dispose();
}
catch
{
}
}
}
#endregion