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

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
T
Threatpost
G
Google Developers Blog
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Exploit Database - CXSecurity.com
H
Heimdal Security Blog
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
Hacker News: Ask HN
Hacker News: Ask HN
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
B
Blog
V2EX - 技术
V2EX - 技术
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
C
Cybersecurity and Infrastructure Security Agency CISA
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Y
Y Combinator Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
Schneier on Security
Schneier on Security
F
Fortinet All Blogs
N
News | PayPal Newsroom
Attack and Defense Labs
Attack and Defense Labs
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
S
Security @ Cisco Blogs
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
Project Zero
Project Zero
I
Intezer
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
SecWiki News
SecWiki News
Martin Fowler
Martin Fowler

博客园 - 世之云枭

网站技术分享 网页内容抓取 推广:湖南省德谦新材料有限公司 Http://www.paint123.cn CentOS MySQL安装和编译【转帖】 缓存容器类的实现(C#) ReadFreeCache 设计一个高效的网络服务器用户管理类 修改自增字段 C++、Java与C#的命名规范总结 (转) VTL-vm模板的变量用法 - 世之云枭 - 博客园 http://www.cnblogs.com/onlytiancai/archive/2009/04/11/1433456.html 数据库中与c#中的数据类型对照 - 世之云枭 - 博客园 SessionID的正确说明 临时文件 细节决定成败 NVelocity 主从表 自动生成清空数据库的SQL语句 自动生成Insert数据的SQL脚本 分页存储过程
常用的获取最大值
世之云枭 · 2008-07-07 · via 博客园 - 世之云枭

-------------------表
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Code]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Code]
GO

CREATE TABLE [dbo].[Code] (
 [id] [int] IDENTITY (1, 1) NOT NULL ,
 [code] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
 [codenumber] [bigint] NULL ,
 [info] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO

/*
这个存储过程主要是用来生成各种各样的单号的。传入一个特别码单号来分清他对应的是那一个类型单号的最大值
*/
create        PROCEDURE [dbo].[addmaxsto] @Code varchar(20) ,@ouototal varchar(50)='' output AS
declare @orderidcard varchar(14)
declare @temp varchar(50)
if (select  left(codenumber,8)  from  code where code=@Code)=(select convert(varchar(8),getdate(),112))--如果是同一天
  begin
    UPDATE code SET codenumber =codenumber +1 where code=@Code    --在原来的单号上加1
  end
else
  begin
     set @orderidcard=(cast((select convert(varchar(8),getdate(),112))as varchar(50)))+'00001' --生成单的编号
     UPDATE code SET codenumber =@orderidcard where code=@Code
  end

 select top 1 @ouototal=codenumber   from (select * from  code where code=@Code)  

output

GO