IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Employee]') AND type IN ('U'))
DROP TABLE [dbo].[Employee]
CREATE TABLE Employee (
ID INT PRIMARY KEY,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
EmailAddress NVARCHAR(100) DEFAULT NULL,
Name VARCHAR(50) default '张三',
Age INT DEFAULT 18
);
sqlserver建表时设置字段初始默认值的示例
于 2024-06-20 12:01:16 首次发布