Re: general network error



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 ***
.



Relevant Pages

  • Re: Capture Before/After data on Multirow Updates
    ... You can't assign multiple row values to a single variable. ... after data for ALL updated records from the update statement. ... Declare @mval2 nvarchar ...
    (microsoft.public.sqlserver.mseq)
  • Re: Oracle Stored Proc issues
    ... I use the value in the update statement. ... G Quesnel wrote: ... declare the text variable to be some extra large number, ... string of text to the variable, then the variable will only contain ...
    (comp.databases.oracle.misc)
  • Number of rows updated
    ... the block is an update statement. ... DECLARE var_a number; ... a bunch of sql statement go here; ...
    (comp.databases.oracle.server)
  • Re: Output and return from stored procedure
    ... > Declare another variable and Set the @@ROWCOUNT to this varibale ... > after your update statement. ...
    (microsoft.public.sqlserver.programming)