[关闭]
@zhouyy 2018-03-16T06:56:43.000000Z 字数 1620 阅读 574

SQL Server

SQL


创建数据库
CREATE DATABASE TestData;
Press the F5 key to execute the code and create the database.

创建表
CREATE TABLE dbo.Products
(ProductID int PRIMARY KEY NOT NULL,
ProductName varchar(25) NOT NULL,
Price money NULL,
ProductDescription text NULL)
GO

切换
USE TestData

插入
INSERT dbo.Products (ProductName, ProductID, Price, ProductDescription)
VALUES ('Screwdriver', 50, 3.17, 'Flat head')
更改
UPDATE dbo.Products
SET ProductName = 'Flat Head Screwdriver'
WHERE ProductID = 50

1、修改字段名:
  alter table 表名 rename column A to B

2、修改字段类型:
  alter table 表名 alter column 字段名 type not null

3、修改字段默认值
  alter table 表名 add default (0) for 字段名 with values
  

云端导入导出

  http://blog.chinaunix.net/uid-16829731-id-3645090.html

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注