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

推荐订阅源

Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
Cisco Talos Blog
Cisco Talos Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
Project Zero
Project Zero
E
Exploit-DB.com RSS Feed
S
Secure Thoughts
K
Kaspersky official blog
L
Lohrmann on Cybersecurity
NISL@THU
NISL@THU
WordPress大学
WordPress大学
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
小众软件
小众软件
P
Privacy & Cybersecurity Law Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
Hacker News: Ask HN
Hacker News: Ask HN
AWS News Blog
AWS News Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hacker News: Front Page
F
Full Disclosure
Latest news
Latest news
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
T
Troy Hunt's Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
G
GRAHAM CLULEY
Forbes - Security
Forbes - Security
V
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
P
Privacy International News Feed
C
Check Point Blog
N
News and Events Feed by Topic

博客园 - Bingo Lee

创业这三年¥.NET之尴尬处境 创业这三年@各种奇遇 创业这3年#迈出第一步 传统企业信息化 中国式IT的项目 谁来衡量我们的价值??? 加班?!希望“京东”不是你的最后一站 WinRAR自动备份文件 ASP.NET MVC3 入门指南之数据验证[源码RAR下载] Sql server 实用技巧之主键、系统表与代码生成器[源码+视频] 英孚订课助手 全自动备份vss和sql数据库(含源码下载) Excel插入、更新Orcale Asp.net MVC3.0 入门指南 7.1 展示查找页面 Asp.net MVC3.0 入门指南 6 审视编辑方法和视图 ASP.NET MVC3.0 入门指南 5 从控制器访问模型数据 Asp.net MVC3.0 入门指南 4 模型 Model Asp.net MVC3.0 入门指南 3.2视图 View Asp.net MVC3.0 入门指南 3.1视图 View
SQL SERVER VS ORCALE(实现已有数据行自增)
Bingo Lee · 2011-06-28 · via 博客园 - Bingo Lee

2011-06-28 10:47  Bingo Lee  阅读(1409)  评论()    收藏  举报

如果数据库中已经存在大量数据,那么如何才能实现自增字段呢?

  • 先说SQL SERVER(据可靠消息,大约十年前这句话卖了70万RMB):

DECLARE @i INT
SET @i = 0UPDATE table_name
SET @i = @i + 1 ,--重点在这里
id = @i


  • 再说ORCALE(用游标是实现)

declare cursor c_cursor is
select uslogin from userinfo where userinfoid is null for update;
--uslogin:登陆账号是唯一的

vr_login c_cursor
%RowType;
vr_i
number:=1;begin
open c_cursor;

loop

fetch c_cursor into vr_login;
exit when c_cursor%notfound;--逐一更新
update userinfo set userinfoid = vr_i where uslogin = vr_login.uslogin;

vr_i :

= vr_i + 1;
end loop;close c_cursor;
end ;