Click here to Skip to main content
15,899,314 members
Home / Discussions / Database
   

Database

 
AnswerRe: how i set Table name and Column name dynmicalyy in Ms sql sp Pin
Marek Grzenkowicz18-Jun-08 0:15
Marek Grzenkowicz18-Jun-08 0:15 
AnswerRe: how i set Table name and Column name dynmicalyy in Ms sql sp Pin
Niraj_Silver26-Jun-08 0:34
Niraj_Silver26-Jun-08 0:34 
QuestionHow to select records between ( 10 to 100) Pin
Logup17-Jun-08 4:26
Logup17-Jun-08 4:26 
AnswerRe: How to select records between ( 10 to 100) Pin
A Wong17-Jun-08 4:30
A Wong17-Jun-08 4:30 
GeneralRe: How to select records between ( 10 to 100) Pin
Logup17-Jun-08 7:56
Logup17-Jun-08 7:56 
AnswerRe: How to select records between ( 10 to 100) Pin
Alsvha17-Jun-08 5:39
Alsvha17-Jun-08 5:39 
QuestionStored Procedure, Commiting Changes Pin
Ian Uy17-Jun-08 3:30
Ian Uy17-Jun-08 3:30 
AnswerRe: Stored Procedure, Commiting Changes Pin
Ashfield17-Jun-08 3:50
Ashfield17-Jun-08 3:50 
do a begin tran, execite your code and after each piece check @@error - if its <> 0 rollback tran and return. At the end commit tran

create proc p1
as

DECLARE	@SqlErrorNum int,
			@SqlErrorText varchar(255),
			@Process varchar (64)

    select @Process = object_name(@@procid)
begin tran

update table ....

select @SqlErrorNum = @@ERROR
IF @SqlErrorNum != 0
BEGIN
		select 	@SqlErrorText = 'updating table'
		goto	ErrorHandler
END

update table2 ....

select @SqlErrorNum = @@ERROR
IF @SqlErrorNum != 0
BEGIN
		select 	@SqlErrorText = 'updating table2'
		goto	ErrorHandler
END

commit tran 
return 0

ErrorHandler:
	SELECT @SqlErrorText = @Process + 'ERROR ' + @SqlErrorText
	INSERT INTO T_In_thinkFolioOvernightLog (processName,note) values (@Process,@SqlErrorText)	
	RAISERROR @SqlErrorNum @SqlErrorText
	RETURN 1


Hope this helps

Bob
Ashfield Consultants Ltd

GeneralRe: Stored Procedure, Commiting Changes Pin
Ian Uy17-Jun-08 4:34
Ian Uy17-Jun-08 4:34 
Questionasp.net insert data Pin
sonalisharma17-Jun-08 2:35
sonalisharma17-Jun-08 2:35 
AnswerRe: asp.net insert data Pin
Colin Angus Mackay17-Jun-08 3:08
Colin Angus Mackay17-Jun-08 3:08 
QuestionComplex SQL query... [modified] Pin
ruanr16-Jun-08 22:19
ruanr16-Jun-08 22:19 
AnswerRe: Complex SQL query... Pin
joemonvarghese80@yahoo.co.in16-Jun-08 22:24
joemonvarghese80@yahoo.co.in16-Jun-08 22:24 
GeneralRe: Complex SQL query... Pin
ruanr16-Jun-08 22:29
ruanr16-Jun-08 22:29 
GeneralRe: Complex SQL query... Pin
joemonvarghese80@yahoo.co.in16-Jun-08 22:55
joemonvarghese80@yahoo.co.in16-Jun-08 22:55 
AnswerRe: Complex SQL query... Pin
Ashfield16-Jun-08 23:58
Ashfield16-Jun-08 23:58 
Questionconvert Pin
trilokharry16-Jun-08 21:40
trilokharry16-Jun-08 21:40 
AnswerRe: convert Pin
joemonvarghese80@yahoo.co.in16-Jun-08 22:27
joemonvarghese80@yahoo.co.in16-Jun-08 22:27 
AnswerRe: convert Pin
Krish - KP16-Jun-08 22:32
Krish - KP16-Jun-08 22:32 
AnswerRe: convert Pin
Ashfield16-Jun-08 22:44
Ashfield16-Jun-08 22:44 
AnswerRe: convert Pin
Mike Dimmick17-Jun-08 6:36
Mike Dimmick17-Jun-08 6:36 
AnswerRe: convert Pin
Niraj_Silver26-Jun-08 0:53
Niraj_Silver26-Jun-08 0:53 
QuestionSQL Injection - String replace best practice Pin
RCoate16-Jun-08 20:51
RCoate16-Jun-08 20:51 
AnswerRe: SQL Injection - String replace best practice Pin
Colin Angus Mackay16-Jun-08 21:43
Colin Angus Mackay16-Jun-08 21:43 
GeneralRe: SQL Injection - String replace best practice Pin
RCoate17-Jun-08 15:59
RCoate17-Jun-08 15:59 

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.