当前位置:网站首页>SQL statement modify field type "suggestions collection"
SQL statement modify field type "suggestions collection"
2022-07-01 09:50:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Modify field name :
sp_rename ‘ Table name . Original field name ’,’ Table name . new field name ’ For example, I want to put Card_Info Inside the watch OnDate Change it to Date: sp_rename ‘Card_Info.OnDate’,’Card_Info.Date’
Change data type :
alter table Table name alter column Name data type For example, I want to put Card_Info Inside the watch Time The data type consists of time(7) Change it to time(0) alter table Card_Info alter column Time time(0)
Modify the field name to be non empty :
ALTER TABLE surface ALTER COLUMN [ Field name ] Field type NOT NULL If I want to Card_Info Inside the watch Time The data type is changed to allow null : alter table Card_Info alter column Time time(0) null If it is changed to non empty, it will be changed to not null;
Add field name :
Universal :alter table [ Table name ] add [ Field name ] Field properties For example, I want to be in CancelCard_Info Add one in the table IsCheck Closing name ; alter table CancelCard_Info add IsCheck varchar(10)
Before, if I wanted to modify the field type, I directly deleted a table in the database and added it again , But I learned this sql It will be much more convenient to modify after the statement . I have tried all the above modification methods ; Very useful sql sentence ;
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/131771.html Link to the original text :https://javaforall.cn
边栏推荐
- SQL学习笔记(02)——数据库表操作
- UE small knowledge point controller possess pawn process
- The "China Mobile Chain" state secret engine was officially launched on BSN
- Postgraduate entrance examination vocabulary 2023 sharing (1)
- Hardware midrange project
- PHP 字符串与二进制相互转换
- Closure implementation iterator effect
- 一个悄然崛起的国产软件,低调又强大!
- 7-Zip boycotted? The callers have committed "three crimes": pseudo open source, unsafe, and the author is from Russia!
- 新数据库时代,不要只学 Oracle、MySQL
猜你喜欢
A quietly rising domestic software, low-key and powerful!
CSDN一站式云服务开放内测,诚邀新老用户来抢鲜
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
js作用域链与闭包
7-Zip 遭抵制?呼吁者定下“三宗罪”:伪开源、不安全、作者来自俄罗斯!
好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与!
Concept of digital currency
CSDN's one-stop cloud service is open for internal testing, and new and old users are sincerely invited to grab the fresh
Flinkv1.13实现金融反诈骗案例
直播管理项目
随机推荐
电脑USB、HDMI、DP各种接口及速度
Huawei accounts work together at multiple ends to create a better internet life
谁拥有穿越周期的眼光?
Introduction to mt7628k eCos development
Mikrotik Routeros Internet access settings
Solution of EPS image blur by latex insertion
Network partition notes
SQL 化是 ETL 增量生产的第一步,这样的架构的核心能力是什么?
“中移链”国密引擎在BSN正式上线
Concept of digital currency
JS prototype trap
The stock position building rate of global funds and asset management reached a new low in 15 years
Swag init error: cannot find type definition: response Response
Sd-wan notes
BSN长话短说之十:如何保证NFT的安全
超标量处理器设计 姚永斌 第4章 分支预测 --4.1 小节摘录
UE small knowledge point controller possess pawn process
PHP code audit and File Inclusion Vulnerability
tryhackme圣诞挑战2021-Advent of Cyber 3-day1-IDOR漏洞,不安全的访问控制漏洞
7-Zip boycotted? The callers have committed "three crimes": pseudo open source, unsafe, and the author is from Russia!