当前位置:网站首页>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
边栏推荐
- 【leetcode】287. Find duplicates
- Live broadcast management project
- [unity rendering] customized screen post-processing
- The "China Mobile Chain" state secret engine was officially launched on BSN
- es6-顶层对象与window的脱钩
- tryhackme圣诞挑战2021-Advent of Cyber 3-day1-IDOR漏洞,不安全的访问控制漏洞
- 历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...
- Ubuntu system installation and MySQL configuration
- Clickhouse: Test on query speed of A-share minute data [Part 2]
- CSDN's one-stop cloud service is open for internal testing, and new and old users are sincerely invited to grab the fresh
猜你喜欢

全球基金和资管的股票建仓率达到15年内新低

Mikrotik Routeros Internet access settings

Dotnet console uses microsoft Maui. Getting started with graphics and skia

华为帐号多端协同,打造美好互联生活

历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...

Apple amplification! It's done so well

CSDN一站式云服务开放内测,诚邀新老用户来抢鲜

2022.02.15_ Daily question leetcode six hundred and ninety

遇到女司机业余开滴滴,日入500!

我喜欢两个男人。。。
随机推荐
mysql截取_mysql截取字符串的方法[通俗易懂]
JS rewrite their own functions
Computer USB, HDMI, DP various interfaces and speeds
PHP merges multiple arrays. The same element takes the intersection of different elements to form an array
[untitled]
js变量提升(hoisting)
Solution of EPS image blur by latex insertion
ES6-const本质与完全不可改实现(Object.freeze)
ES6 const essence and completely immutable implementation (object.free)
Introduction to expressions and operators in C language
Niuke monthly race 22 tree sub chain
JS scope chain and closure
短路运算符惰性求值
JS prototype inheritance can only inherit instances, not constructors
SQL learning notes (03) -- data constraint relationship
The stock position building rate of global funds and asset management reached a new low in 15 years
Weidongshan board compilation kernel problem solving
JS prototype chain
A 419 error occurred in the laravel postman submission form. July 6th, 2020 diary.
7-Zip boycotted? The callers have committed "three crimes": pseudo open source, unsafe, and the author is from Russia!