sql server 2000已经设计好的表 如何设置id自动增加
2个回答
展开全部
只要把ID设置为主键,属性里有个自动增加列选上就行了
追问
我想用sql语句试试!
追答
CREATE TABLE [dbo].[tablename](
[id] [numeric](19, 0) IDENTITY(1,1) NOT NULL,
[name] [varchar](200) NULL,
[content] [varchar](1500) NULL,
[createtime] [datetime] NULL,
[creator] [numeric](19, 0) NULL,
CONSTRAINT [PK_tablename] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
create table tb(name varchar(10) primary key)
就这么简单
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询