use master
go
drop database mydata
go
create database mydata
go
use mydata
go
create table t_user
(
userguid uniqueidentifier not null default newid(),
username nvarchar(max) not null default N'',
userpassword nvarchar(max) not null default N'',
createdatetime smalldatetime not null default getdate(),
lastalterdatetime smalldatetime not null default getdate(),
a1 bit not null default 0,
a2 bit not null default 0,
a3 bit not null default 0,
a4 bit not null default 0,
b1 bit not null default 0,
b2 bit not null default 0,
b3 bit not null default 0,
b4 bit not null default 0,
c1 bit not null default 0,
c2 bit not null default 0,
c3 bit not null default 0,
c4 bit not null default 0,
d1 bit not null default 0,
d2 bit not null default 0,
d3 bit not null default 0,
d4 bit not null default 0,
primary key (userguid),
)
insert into t_user (username, userpassword) values (N'张三', N'zs123')
insert into t_user (username, userpassword) values (N'里斯', N'as645df')
insert into t_user (username, userpassword) values (N'aaa', N'asdsdf')
insert into t_user (username, userpassword) values (N'a', N'b')
select * from t_user where username = 'AAA'
select * from t_user
create table t_admin
(
adminguid uniqueidentifier not null default newid(),
adminname nvarchar(max) not null default N'',
adminpassword nvarchar(max) not null default N'',
createdatetime smalldatetime not null default getdate(),
lastaltertime smalldatetime not null default getdate(),
primary key (adminguid)
)
insert into t_admin (adminname, adminpassword) values (N'admin', N'admin')
select * from t_admin
sqlserver2014建表uuid
最新推荐文章于 2025-07-01 10:35:32 发布
本文详细介绍了如何使用 SQL Server 创建数据库和用户表,包括数据类型、默认值、主键设置等,并通过实例演示了插入数据和查询操作。
3万+

被折叠的 条评论
为什么被折叠?



