Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

i am getting error as An explicit value for the identity column in table 'product' can only be specified when a column list is used and IDENTITY_INSERT is ON.

$
0
0

--First table

create table product([id] int identity primary key,[name] nvarchar(50),[description] nvarchar(50))
insert into product values(1,'tv','52 inches '),(2,'laptops','16 inches '),(3,'desktop','32 inches ')
select * from product

--2nd table

create  table productsales(id int  primary key identity, unitprice int,quantitysold int)
insert into productsales values(3,450,5),(2,250,7),(3,600,4),(3,222,8)
alter table productsales add constraint  fk1 foreign key(id)
  references product ([id])                       
  on update cascade 
  on delete cascade


jitendra


Viewing all articles
Browse latest Browse all 23857

Trending Articles