当前位置:网站首页>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
边栏推荐
- Swag init error: cannot find type definition: response Response
- Flinkv1.13 implementation of financial anti fraud cases
- Rich text interpolation
- Short circuit operator lazy evaluation
- Weidongshan board compilation kernel problem solving
- Voice service notes
- PHP code audit and File Inclusion Vulnerability
- Hololens2 development -6-eyetracking and speech recognition
- Wechat applet WebView prohibits page scrolling without affecting the implementation of overflow scrolling in the business
- The latest masterpiece of Alibaba, which took 182 days to produce 1015 pages of distributed full stack manual, is so delicious
猜你喜欢
随机推荐
PO模式深入封装
LVGL V8.2字符串显示在Keil MDK上需要注意的事项(以小熊派为例)
LeetCode 344. Reverse string
TC8:UDP_USER_INTERFACE_01-08
Computer USB, HDMI, DP various interfaces and speeds
CSDN一站式云服务开放内测,诚邀新老用户来抢鲜
JS variable lifting
编写自己的who命令
富文本实现插值
年薪100万,在北上广深买的起房子吗?
【无标题】
Hololens2 development -6-eyetracking and speech recognition
电脑USB、HDMI、DP各种接口及速度
项目必用的全局异常处理器,你学会了吗
HMS Core音频编辑服务3D音频技术,助力打造沉浸式听觉盛宴
JS prototype chain
谁拥有穿越周期的眼光?
Project procurement management
Hardware midrange project
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”









