新建一張數據表,將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)
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com