Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Error Msg 8101, Level 16, State 1

Author  Topic 

ddtopgun
Starting Member

26 Posts

Posted - 2014-05-26 : 05:43:28
HI All,

i want to insert data in sp but after execeute there an error :
Msg 8101, Level 16, State 1, Procedure sp_savedepart, Line 14
An explicit value for the identity column in table 'Departemen' can only be specified when a column list is used and IDENTITY_INSERT is ON.

here is my sp :
CREATE PROCEDURE sp_savedepart
@nmDepartemen varchar(30)

AS
BEGIN
SET IDENTITY_INSERT Departemen ON
--DBCC CHECKIDENT (Departemen, reseed, 1)
INSERT INTO [Departemen](idDepartemen,nmDepartemen) VALUES (@nmDepartemen)

SET IDENTITY_INSERT Departemen OFF
END
GO


but still an error

MuralikrishnaVeera
Posting Yak Master

129 Posts

Posted - 2014-05-26 : 05:55:50
You need to pass value for idDepartemen
Try someting like this

INSERT INTO [Departemen](idDepartemen,nmDepartemen) VALUES (2,@nmDepartemen)


---------------
Murali Krishna

You live only once ..If you do it right once is enough.......
Go to Top of Page

ddtopgun
Starting Member

26 Posts

Posted - 2014-05-28 : 00:10:47
problem is solved, i forgot to use alter sp if i modify the code..
Go to Top of Page
   

- Advertisement -