Re: general network error
- From: NotAGuru <notaguru@xxxxxxxxxxx>
- Date: Fri, 29 Jul 2005 22:20:13 GMT
Thanks! I looked at errors log too - there are no errors.
The code would not tell you anything it is just an update statement but
here it is:
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[Name]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Name]
GO
CREATE PROCEDURE Name
@var1 varchar(64),
@var2 tinyint = NULL,
@var3 char(2) = NULL,
@var4 smallint = NULL,
@var5 int = NULL,
@var6 smallint = NULL,
@var7 varchar(20) = NULL,
@var8 smallint = NULL
AS
set nocount on
declare @section_name varchar(500)
declare @error integer
set @error = 0
DECLARE @return_code INTEGER
SET @return_code = 0
declare @proc_name varchar(100)
set @proc_name = (select name from sysobjects (NOLOCK) where id =
@@procid)
set @section_name = 'Update '
UPDATE Name
SET col2= @var2,
col3= @var3,
col4= @var4,
col5= @var5,
col6= @var6,
col7= @var7,
date= GETDATE()
WHERE col1= @var1
/**** check for errors and log results
******************************/
set @error = @@error
if @error <> 0 goto failure
/********************************************************************/
set @section_name = 'exit procedure with success'
goto exit_procedure
failure:
begin
declare @error_text varchar(1500)
set @error_text =
'Procedure: "' + @proc_name + '" ' + char(13) +
'Parameters: ' + char(13) +
'Section Name: ' + isnull(@section_name,'(null)')
if @@trancount > 0
begin
rollback transaction
set @error_text = @error_text + char(13) + 'Rollback occurred. '
end
if @error >= 50000 raiserror(@error, 16, 1)
raiserror(@error_text, 16, 1)
set @return_code = @error
end
exit_procedure:
return @return_code
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
*** Sent via Developersdex http://www.developersdex.com ***
.
- Follow-Ups:
- Re: general network error
- From: Erland Sommarskog
- Re: general network error
- References:
- Re: general network error
- From: Erland Sommarskog
- Re: general network error
- Prev by Date: Re: My design - where did I go wrong?
- Next by Date: Re: All Roads Lead to Rome but which One is Most Desirable?
- Previous by thread: Re: general network error
- Next by thread: Re: general network error
- Index(es):
Relevant Pages
|