Click here to Skip to main content
15,897,371 members
Home / Discussions / Database
   

Database

 
AnswerRe: What is the best way to track 'database' modifications? Pin
Mycroft Holmes11-Oct-10 12:33
professionalMycroft Holmes11-Oct-10 12:33 
GeneralRe: What is the best way to track 'database' modifications? Pin
Luc Pattyn11-Oct-10 12:44
sitebuilderLuc Pattyn11-Oct-10 12:44 
GeneralRe: What is the best way to track 'database' modifications? Pin
Mycroft Holmes11-Oct-10 14:08
professionalMycroft Holmes11-Oct-10 14:08 
AnswerRe: What is the best way to track 'database' modifications? Pin
i.j.russell11-Oct-10 12:46
i.j.russell11-Oct-10 12:46 
QuestionSQL Functions Pin
eraser9509-Oct-10 3:00
eraser9509-Oct-10 3:00 
AnswerRe: SQL Functions Pin
PIEBALDconsult9-Oct-10 3:44
mvePIEBALDconsult9-Oct-10 3:44 
GeneralRe: SQL Functions Pin
eraser9509-Oct-10 23:54
eraser9509-Oct-10 23:54 
Questioncanot update identity column Pin
future38397-Oct-10 4:47
future38397-Oct-10 4:47 
Hi, I am running VS2008 and use SQLExpress. I craete a SP in my database. then when I wanna save it I will get this error : Cannot update identity column 'Code'

the above code is my SP
Create PROCEDURE dbo.SprocInsertUpdatePerson
(
	@code int,
	@id int,
	@name nvarchar(50),
	@passportNumber nvarchar(50),
	@nationality nvarchar(50),
	@created datetime,
	@creator nvarchar(50)	
)
AS

	Declare @ReturnValue int
	if (@Code IS NULL) --New Item
	Begin
		insert into Person
		(
			Code,
			Id,
			Name,
			PassportNumber,
			Nationality,
			Created,
			Creator
		)	
		values
		(
			@code,
			@id,
			@name,
			@passportNumber,
			@nationality,
			@created,
			@creator
		)
		
		Select @ReturnValue = Scope_Identity()
		
	End
	
	
	else
	
	Begin --Update Item
		Update Person  		
		Set Code = @code,
		Id = @id,
		Name = @name,
		PassportNumber = @passportNumber,
		Nationality = @nationality,
		Created = @created,
		Creator = @creator				
		where Id = @id
		
		Select @ReturnValue = @Id
	End
	
	
	IF (@@ERROR != 0)
	BEGIN
		RETURN -1
	END
	ELSE
	BEGIN
		RETURN @ReturnValue
	END



I really appreciate if someone help me.


thx a lot
AnswerRe: canot update identity column Pin
Eddy Vluggen7-Oct-10 7:11
professionalEddy Vluggen7-Oct-10 7:11 
AnswerRe: canot update identity column Pin
NeverHeardOfMe7-Oct-10 7:12
NeverHeardOfMe7-Oct-10 7:12 
AnswerRe: canot update identity column Pin
Bernhard Hiller7-Oct-10 21:36
Bernhard Hiller7-Oct-10 21:36 
GeneralRe: canot update identity column Pin
future38397-Oct-10 21:59
future38397-Oct-10 21:59 
QuestionWhat should I do to connect JavaScript to database Pin
blitz2bleach6-Oct-10 23:50
blitz2bleach6-Oct-10 23:50 
AnswerRe: What should I do to connect JavaScript to database Pin
J4amieC7-Oct-10 0:52
J4amieC7-Oct-10 0:52 
AnswerRe: What should I do to connect JavaScript to database Pin
Eddy Vluggen7-Oct-10 7:13
professionalEddy Vluggen7-Oct-10 7:13 
GeneralRe: What should I do to connect JavaScript to database Pin
blitz2bleach7-Oct-10 10:37
blitz2bleach7-Oct-10 10:37 
GeneralRe: What should I do to connect JavaScript to database Pin
Eddy Vluggen7-Oct-10 11:38
professionalEddy Vluggen7-Oct-10 11:38 
QuestionCan drop temptable from different server? Pin
Naunt6-Oct-10 22:25
Naunt6-Oct-10 22:25 
AnswerRe: Can drop temptable from different server? Pin
Blue_Boy6-Oct-10 22:49
Blue_Boy6-Oct-10 22:49 
GeneralRe: Can drop temptable from different server? Pin
Naunt6-Oct-10 23:02
Naunt6-Oct-10 23:02 
GeneralRe: Can drop temptable from different server? Pin
Blue_Boy6-Oct-10 23:26
Blue_Boy6-Oct-10 23:26 
GeneralRe: Can drop temptable from different server? Pin
Naunt6-Oct-10 23:51
Naunt6-Oct-10 23:51 
GeneralRe: Can drop temptable from different server? Pin
Eddy Vluggen7-Oct-10 11:50
professionalEddy Vluggen7-Oct-10 11:50 
GeneralRe: Can drop temptable from different server? Pin
Naunt7-Oct-10 15:51
Naunt7-Oct-10 15:51 
GeneralRe: Can drop temptable from different server? Pin
Blue_Boy7-Oct-10 20:32
Blue_Boy7-Oct-10 20:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.