惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
N
Netflix TechBlog - Medium
P
Proofpoint News Feed
D
Docker
J
Java Code Geeks
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
腾讯CDC
罗磊的独立博客
U
Unit 42
爱范儿
爱范儿
Vercel News
Vercel News
MyScale Blog
MyScale Blog

博客园 - 一味

[翻译]实例:在Android调用WCF服务 基于LRU淘汰的高性能缓存 不是架构的架构之五:业务层的实现与自动代理(补充) 不是架构的架构之四:业务层的实现与自动代理 不是架构的架构之三:系统基础(2)主键选择和并发 不是架构的架构之二:系统基础(1) 不是架构的架构之一:总体思路 一道算法题 技术先行or业务先行 用了一年的键盘,记录下键盘磨损的状况 一个业务系统设计构想(一) 安装VS2008/.Net3.5/.Net3.0/.Net2.0sp1失败的解决办法 常用存储过程3(获取编码的上级编码和短编码) 常用存储过程2(获取编码级次) 常用存储过程1(获取字符串中的第一个数值) SQL Server中Rollup关键字使用技巧 Math.Round函数四舍五入的问题 SQL Server进程阻塞的检查和解决办法(转自好友Blog) 学习NHibernate的感悟和疑惑
常用存储过程4(K310。3版本获取物流新单据的编码)
一味 · 2008-04-15 · via 博客园 - 一味

Create Proc GetICBillNo
 
@billtype int,
 
@isuse bit,
 
@billno varchar(100) out
as

set @billno=''

select a.*,isnull(b.ftable,''as ftable,isnull(e.ffieldname,''as FieldName
into #tmp
from t_billcoderule a
 
left join t_option e on a.fprojectid=e.fprojectid and a.fformatindex=e.fid
 
Left OUter join t_checkproject b on a.fbilltype=b.fbilltypeid and a.fprojectval=b.ffield
 
where a.fbilltypeid = @billtype order by a.FClassIndex

declare @pid int,@pval varchar(20),@length int,@format varchar(20)
DECLARE cc CURSOR FOR 
SELECT FProjectID, FProjectVal, FLength,FFormatIndex
FROM #tmp
ORDER BY FClassIndex

OPEN cc

FETCH NEXT FROM cc 
INTO @pid,@pval,@length,@format

WHILE @@FETCH_STATUS = 0
BEGIN
 
if(@pid=1)
 
begin
  
set @billno=@billno+@pval
 
end
 
else if(@pid=3)
 
begin
  
declare @v varchar(100)
  
set @v='00000000000000000000000000000000000000000000000000000000'
  
set @billno=@billno+left(@v,@length-len(@pval))+@pval
 
end

 
FETCH NEXT FROM cc 
  
INTO @pid,@pval,@length,@format
END

CLOSE cc
DEALLOCATE cc

if(@isuse=1)
 
Update t_billcoderule set FProjectVal=Cast(FProjectVal as int)+1  where fbilltypeid = @billtype and FProjectID=3 
select @billno

GO
declare @no varchar(100)
Exec GetICBillNo 80,0,@no out
print @no