当前位置:网站首页>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
边栏推荐
- JS prototype trap
- Clickhouse: Test on query speed of A-share minute data [Part 2]
- Concept of digital currency
- Using closures to implement private variables
- Project procurement management
- 主流实时流处理计算框架Flink初体验
- Mikrotik Routeros Internet access settings
- uniapp微信小程序组件按需引入
- CSDN一站式云服务开放内测,诚邀新老用户来抢鲜
- Swag init error: cannot find type definition: response Response
猜你喜欢
随机推荐
BSN long story 10: how to ensure the safety of NFT
Win11账号被锁定无法登录怎么办?Win11账号被锁定无法登录
Hardware midrange project
京东与腾讯续签三年战略合作协议;起薪涨至26万元!韩国三星SK争相加薪留住半导体人才;Firefox 102 发布|极客头条...
Differences between JS valueof and toString
Construction of esp8266 FreeRTOS development environment
js作用域链与闭包
Configure load balancing
MapReduce programming basics
JS functionarguments object
Graduation summary of actual combat camp
Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"
直播管理项目
Get the list of a column in phpexcel get the letters of a column
好高的佣金,《新程序员》合伙人计划来袭,人人皆可参与!
JS prototype inheritance can only inherit instances, not constructors
ESP8266 FreeRTOS开发环境搭建
MT7628K eCos开发入门
I like two men...
How Kolo enables NFT music industry








