SQL语句修改字段类型

mysql中

alert table name modify column name type;

例子:修改user表中的name属性类型为varchar(50)

alert table user modify column name varchar(50);

Sqlserver中

alter table 表名 alter column 列明 type

例子:alter table tb_user alter column user_name varchar(60)

oracle中

alter    table   table_name     alter column   column_name new_data_type

例子:alter table tb_user alter column user_name varchar(60)

第一次SQLServer试验


--第一次试验
--创建数据库BooksInfo
create database BooksInfo
--在库BooksInfo下创建表BookInfo、LendInfo
use BooksInfo
create table BookInfo(
BookId int NOT NULL,
BookName varchar(50) NOT NULL,
PublishMan char(30) NOT NULL,
BookBuymoney numeric(5,2),
bookbuytime datetime,
BookYesNo bit
)

create table LendInfo(
UserId varchar(10),
BookId int,
LendTime datetime,
backTime datetime,
UserMoney money
)
--向BookInfo表中增加一列BookKind  varchar(20)
Alter table BookInfo add BookKind varchar(20)
--修改BookInfo表中BookBuyMoney的数据类型为money
alter table BookInfo alter column BookBuymoney money
--删除BookInfo表中的一列PublishMan
Alter table BookInfo drop column PublishMan
--删除表BookInfo、LendInfo
drop table BookInfo
drop table LendInfo

最新文章

  1. ASP.NET MVC3中Controller与View之间的数据传递
  2. MyBatis的经典案例
  3. html5手机端遮罩弹出菜单代码
  4. <转>人生与最速曲线
  5. webService 部署以后参数输入框不能显示
  6. OC 复合 组装电脑
  7. hdu 5407 CRB and Candies(组合数+最小公倍数+素数表+逆元)2015 Multi-University Training Contest 10
  8. vc编程时说“Cannot open include file: 'unistd.h': No such file or directory”
  9. CircularProgressBar
  10. poj2761Feed the dogs(划分树-区间K值)
  11. Html笔记(五)表格
  12. LabVIEW设计模式系列——普遍使用值改变事件
  13. Http响应报文
  14. java线程中的sleep和wait区别
  15. [转]SHSH, APTicket以及iOS降級
  16. Telnet 在win7 和 xp中的使用
  17. Java 适配器(Adapter)模式
  18. Module 的语法
  19. 【MM系列】SAP基本计量单位更改
  20. LOJ2116 [HNOI2015] 开店 【点分治】

热门文章

  1. SpringCloud升级之路2020.0.x版-26.OpenFeign的组件
  2. 安装Transformers与ValueError: Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' 'truncation=True' to have batched tensors with the same length.报错
  3. mysql 建表后 重新构建 自增字段 (保留 原有字段结构)
  4. DL4J实战之三:经典卷积实例(LeNet-5)
  5. 第29篇-调用Java主类的main()方法
  6. SpringMVC 数据响应
  7. scala基础篇 源码中 :_*的作用
  8. java的加载与执行原理详解
  9. leetcode347 —— n中topK && PriorityQueue(Heap) && Map遍历
  10. 如何将jdk12的源码导入idea