当前位置:首页 > PHP教程 > PHP总结归纳

SqlServer代码设置主键并自动生长

新建一张数据表,将userid设为主键并自动增长 create table t_userlogin(userid int not null primary key identity(1,1),username nvarchar(50) not null,pass varchar(50) not null ) 修改已经建好的一张数据表,将userid设为主键并自动生长 alter table t

  新建一张数据表,将userid设为主键并自动增长

  create table t_userlogin(userid int not null primary key identity(1,1),username nvarchar(50) not null,pass varchar(50) not null )

  修改已经建好的一张数据表,,将userid设为主键并自动生长

  alter table tb alter column id int not null

  alter table tb add constraint pkid primary key (id)

  删除主键

  declare @pk varchar(100);

  select @pk=name from sysobjects where parent_obj=object_id('tb') and xtype='pk';

  if @pk is not null

  exec('alter table tb drop '+ @pk)

吐了个 "cao" !
吐个槽吧,看都看了
.syntaxhighlighter{padding-top:20px;padding-bottom:20px;} syntaxhighlighter.config.clipboardswf = 'https://www.php1.cn/syntaxhighlighter/scripts/clipboard.swf'; syntaxhighlighter.all();
tools online | 在线开发工具
  • html/js格式化/压缩
  • css代码格式化工具
  • 文章自动排版工具
  • html/js转换
  • utf-8编码转换工具
  • unicode 转换
  • url编码解码
  • 二维码生成工具
  • ip地址查询
  • http状态码(响应码)
  • 网页header头
  • 网页源代码
  • json解析着色
  • diff文件比较
ranklist | 热门文章
  • 1the top 5 metrics to watch in mongodb
  • 2mongodb 更改数据类型
  • 3代理设置问题引起的unknownhostexception jsoup执行execute()错
  • 4非阻塞同步算法实战(三)-latestresultsprovider
  • 5surviving success at matchbook: using mms to track
  • 6mysql状态报表工具
  • 7postgresql和mysql的对比,第1部分:表组织
  • 8
    【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!