Click here to Skip to main content
15,891,473 members
Home / Discussions / Database
   

Database

 
GeneralRe: BULK INSERT using oracle ODBC driver Pin
Mycroft Holmes29-Oct-10 12:40
professionalMycroft Holmes29-Oct-10 12:40 
GeneralRe: BULK INSERT using oracle ODBC driver Pin
Rajesh Anuhya29-Oct-10 18:57
professionalRajesh Anuhya29-Oct-10 18:57 
AnswerRe: BULK INSERT using oracle ODBC driver Pin
Rajesh Anuhya29-Oct-10 18:51
professionalRajesh Anuhya29-Oct-10 18:51 
Questioninsert and update Pin
future383929-Oct-10 0:02
future383929-Oct-10 0:02 
AnswerRe: insert and update Pin
Rajesh Anuhya29-Oct-10 0:15
professionalRajesh Anuhya29-Oct-10 0:15 
GeneralRe: insert and update Pin
future383929-Oct-10 0:22
future383929-Oct-10 0:22 
AnswerRe: insert and update Pin
Mycroft Holmes29-Oct-10 0:35
professionalMycroft Holmes29-Oct-10 0:35 
GeneralRe: insert and update Pin
future383929-Oct-10 3:01
future383929-Oct-10 3:01 
hi,
this is my code
USE [Hostel]
GO
/****** Object:  StoredProcedure [dbo].[SprocInsertUpdatePerson]    Script Date: 10/29/2010 23:54:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SprocInsertUpdatePerson]
(-- Definition of Storeprocedure's parameter
	@id int,	
	@fname nvarchar(50),
	@srname nvarchar(50),
	@gender nvarchar(15),
	@dob datetime,
	@transactionid int	
)
AS

	Declare @ReturnValue int
	if (@id IS NULL) --New Item
	Begin
		insert into Person_prs
		(
			--id_prs,
			fname_prs,
			srname_prs,
			gender_prs,
			dob_prs,
			transactionid_prs
		)	
		values
		(
			--@id,
			@fname ,
			@srname,
			@gender,
			@dob ,
			@transactionid			
		)
		
		Select @id = Scope_Identity()--Returns the last identity value inserted into an identity column in the same scope.
		
	End
	
	
	else
	
	Begin --Update Item
		Update Person_prs  		
		Set 
		--Id = @id,
		fname_prs = @fname,
		srname_prs = @srname,
		gender_prs = @gender,
		dob_prs = @dob,
		transactionid_prs = @transactionid
		where  id_prs = @id
		
		Select @id as id
	End
	
	
	IF (@@ERROR != 0)
	BEGIN
		RETURN -1
	END
	ELSE
	BEGIN
		RETURN @ReturnValue
	END


the id_prs field is autonumber. I run SP by this value
execute SprocInsertUpdatePerson 11,'XXX','YYY','male','1988/10/10',1200

select * from Person_prs


after select table nothing insert into table.while I have to add data and when pass parameter can update it.
could you please help me??
GeneralRe: insert and update Pin
Mycroft Holmes29-Oct-10 12:38
professionalMycroft Holmes29-Oct-10 12:38 
AnswerRe: insert and update Pin
Rajesh Anuhya29-Oct-10 3:08
professionalRajesh Anuhya29-Oct-10 3:08 
GeneralRe: insert and update Pin
future383929-Oct-10 3:15
future383929-Oct-10 3:15 
GeneralRe: insert and update Pin
future383929-Oct-10 3:25
future383929-Oct-10 3:25 
Questionget the record identity from PostgreSQ/ Pin
Jassim Rahma28-Oct-10 4:57
Jassim Rahma28-Oct-10 4:57 
AnswerRe: get the record identity from PostgreSQ/ Pin
Chris Meech28-Oct-10 5:16
Chris Meech28-Oct-10 5:16 
AnswerRe: get the record identity from PostgreSQ/ Pin
David Skelly28-Oct-10 22:35
David Skelly28-Oct-10 22:35 
QuestionPivot? Pin
mark_w_28-Oct-10 3:08
mark_w_28-Oct-10 3:08 
AnswerRe: Pivot? Pin
Goutam Patra28-Oct-10 3:18
professionalGoutam Patra28-Oct-10 3:18 
GeneralRe: Pivot? Pin
mark_w_28-Oct-10 3:24
mark_w_28-Oct-10 3:24 
GeneralRe: Pivot? Pin
Goutam Patra28-Oct-10 3:35
professionalGoutam Patra28-Oct-10 3:35 
AnswerRe: Pivot? Pin
David Mujica28-Oct-10 4:19
David Mujica28-Oct-10 4:19 
GeneralRe: Pivot? Pin
mark_w_28-Oct-10 4:25
mark_w_28-Oct-10 4:25 
AnswerRe: Pivot? Pin
Mycroft Holmes28-Oct-10 13:56
professionalMycroft Holmes28-Oct-10 13:56 
GeneralRe: Pivot? Pin
mark_w_28-Oct-10 21:42
mark_w_28-Oct-10 21:42 
GeneralRe: Pivot? Pin
Mycroft Holmes28-Oct-10 22:20
professionalMycroft Holmes28-Oct-10 22:20 
GeneralRe: Pivot? Pin
mark_w_28-Oct-10 22:32
mark_w_28-Oct-10 22: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.