首页 > 数据库 > 数据库开发技术 > MSSQL 社会保险
MSSQL 2K 下存储过程,功能:社会保险名单
USE XXX-TSKY
GO
执行命令格式:sp_socialInsurance 'YYYYMM'
[@more@]
sp_socialInsurance '200905'
--drop procedure sp_socialInsurance
create procedure sp_socialInsurance
@yearMonth varchar(6) /* 格式化:YYYYMM */
with encryption /*加密存储过程*/
as
begin
if len(@yearMonth)!=6
BEGIN
raisError('日期的格式不对',16,-1)
return
END
select a.name,case b.sex when '0' then '女' else '男' end sex ,
b.idcardNo as 身份证号, 用工性质='临时工' ,职工类别='在职', case when faddRess like '%东莞%' then '市内' else '市外' end 户口性质
,缴费工资='1030',企业养老='1',地方养老='1'
,机关养老='0',工伤='1' ,失业='1' ,生育='0' ,综合基本='0' , 住院基本='1',
住院补充='0' ,公务员='0' ,子女基本='0' ,门诊='0' ,
/* case when (tbdt is not null) then left(convert(varchar(8),cast(b.tbdt as datetime),112),6) else */
left(convert(varchar(8),dateAdd(month,1,b.indt),112),6) as 企业养老参保年月
from rs_salary_report_mx a,rs_person_1 b
where a.mon in(@yearMonth) and a.a22=87 and b.pnl=a.pnl /* and b.idcardNo is null */ order by a.deptNo,a.pnl
end
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/729024/viewspace-1022826/ ,如需转载,请注明出处,否则将追究法律责任。