新建一張數(shù)據(jù)表,將Userid設(shè)為主鍵并自動增長 create table T_UserLogin(UserId int not null primary key identity(1,1),UserName nvarchar(50) not null,Pass varchar(50) not null ) 修改已經(jīng)建好的一張數(shù)據(jù)表,將Userid設(shè)為主鍵并自動生長 alter table t
新建一張數(shù)據(jù)表,將Userid設(shè)為主鍵并自動增長
create table T_UserLogin(UserId int not null primary key identity(1,1),UserName nvarchar(50) not null,Pass varchar(50) not null )
修改已經(jīng)建好的一張數(shù)據(jù)表,,將Userid設(shè)為主鍵并自動生長
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)
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com