sqlserver2005自动创建数据表和自动添加某个字段索引
创建数据表的SQL语句如下:
string tatlename = "T_useruid";//定义一个变量。用于自动创建数据表的名称,当前表名为:T_useruid
string sql = "CREATE TABLE [dbo].[" + tatlename + "]([Cid] [int] IDENTITY(1,1) NOT NULL,[Uid] [nchar](32) COLLATE Chinese_PRC_CI_AS NULL,CONSTRAINT [PK_" + tatlename + "] PRIMARY KEY CLUSTERED ([Cid] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]";
给这个数据表:T_useruid 的Uid字段增加一个索引
string sql = "CREATE UNIQUE INDEX PK_T_useruid_u ON T_useruid (Uid)";
分析SQL:CREATE UNIQUE INDEX 索引名称 ON 数据表名称 (字段名称)
string tatlename = "T_useruid";//定义一个变量。用于自动创建数据表的名称,当前表名为:T_useruid
string sql = "CREATE TABLE [dbo].[" + tatlename + "]([Cid] [int] IDENTITY(1,1) NOT NULL,[Uid] [nchar](32) COLLATE Chinese_PRC_CI_AS NULL,CONSTRAINT [PK_" + tatlename + "] PRIMARY KEY CLUSTERED ([Cid] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]";
给这个数据表:T_useruid 的Uid字段增加一个索引
string sql = "CREATE UNIQUE INDEX PK_T_useruid_u ON T_useruid (Uid)";
分析SQL:CREATE UNIQUE INDEX 索引名称 ON 数据表名称 (字段名称)
相关推荐
FellowYourHeart 2020-10-05
bianxq 2020-06-28
景泽元的编程 2020-06-21
韩学敏 2020-06-17
wuhen 2020-06-14
morexyoung 2020-06-13
lanmantech 2020-06-07
敏敏张 2020-06-06
勇往直前 2020-06-01
msmysql 2020-05-29
Noseparte 2020-05-28
zhangxiaojiakele 2020-05-25
CSDN0BLOG 2020-05-16
IBMRational 2020-05-14
Zhangdragonfly 2020-05-14
gamestart0 2020-04-10
仁鱼 2020-05-10
lijiawnen 2020-05-01
dayi 2020-04-29