Re: Insert SQL does not work in stored procedure.

From: oj (nospam_ojngo_at_home.com)
Date: 01/17/05


Date: Mon, 17 Jan 2005 14:36:40 -0800

You're experiencing 'implicit transaction' mode.

http://msdn.microsoft.com/library/en-us/tsqlref/ts_set-set_7mur.asp

"Mike G" <MikeG@discussions.microsoft.com> wrote in message
news:9A3B99A5-C119-489B-8670-C58C2FBD19CB@microsoft.com...
> On one of our development servers I've run into a problem with Insert
> command. The stored procedure works on other servers and used to work on
> this server. I've reduced the actual code to a trivial set that still
> exhibits the behavior.
>
> SET QUOTED_IDENTIFIER OFF
> GO
> SET ANSI_NULLS OFF
> GO
>
> ALTER procedure sp_wr_xmldoc3_ex @doc_passed text -- uniqueidentifier
> as
> begin tran
>
> ------------------------------------------------------------------------------------
> -- DEBUG!
> insert into Logical_Tag_Data
> ( uopLogicalTagId, uopTimeStart, uopTimeEnd, uopFltValue, uopStrValue )
> values
> (
> '3AF75E96-F354-49E2-97AC-DC9779EE7B5F',
> '2005-01-11 00:00:00.000',
> '2005-01-11 23:00:00.000',
> 723.75238037109398,
> '723.75238037109398'
> )
> select * from Logical_tag_data where
> uopLogicalTagId='3AF75E96-F354-49E2-97AC-DC9779EE7B5F'
> commit tran
>
> return 1
> ------------------------------------------------------------------------------------
>
> Here is the output:
>
>
>
> uopLogicalTagId uopTimeStart
> uopTimeEnd
> uopFltValue uopStrValue
>
>
>
> uopPercentGood
> ------------------------------------
> ------------------------------------------------------
> ------------------------------------------------------
> -----------------------------------------------------
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> --------------
> 3AF75E96-F354-49E2-97AC-DC9779EE7B5F 2005-01-11 00:00:00.000
> 2005-01-11 23:00:00.000
> 723.75238037109386 723.75238037109398
>
>
>
> NULL
>
>
> @RETURN_VALUE = 1
>
> After this if I run a simple query (select * from Logical_tag_data where
> uopLogicalTagId='3AF75E96-F354-49E2-97AC-DC9779EE7B5F') I don't see the
> record I just added. And if I run this stored procedure a second time,
> again
> only 1 record is being displayed. However, if I run the following
> commands
> with the exact same insert everything works fine:
>
>
> BEGIN TRANSACTION
> insert into Logical_Tag_Data
> ( uopLogicalTagId, uopTimeStart, uopTimeEnd, uopFltValue, uopStrValue )
> values
> (
> '3AF75E96-F354-49E2-97AC-DC9779EE7B5F',
> '2005-01-11 00:00:00.000',
> '2005-01-11 23:00:00.000',
> 723.75238037109398,
> '723.75238037109398'
> )
> COMMIT
> select * from Logical_tag_data where
> uopLogicalTagId='3AF75E96-F354-49E2-97AC-DC9779EE7B5F'
>
> Every time I run it I get an additional record (as expected).
>
> I've tried running the database maintenance to make sure that the database
> is not corrupt. And I've tried making a brand new table, but the stored
> procudure insert still does not work.
>
> Help!
>
> Thanks,
> Mike
>



Relevant Pages

  • Insert SQL does not work in stored procedure.
    ... On one of our development servers I've run into a problem with Insert ... command. ... The stored procedure works on other servers and used to work on ... (uopLogicalTagId, uopTimeStart, uopTimeEnd, uopFltValue, uopStrValue) ...
    (microsoft.public.sqlserver.programming)
  • [2/3] POHMELFS: Documentation.
    ... * Client is able to switch between different servers (if one goes down, ... * Read requests balancing between multiple servers. ... Each transaction contains all information needed to process given command ...
    (Linux-Kernel)
  • [2/3] POHMELFS: documentation.
    ... +POHMELFS: Parallel Optimized Host Message Exchange Layered File System. ... * Read request balancing between multiple servers. ... +command (or set of commands, which is frequently used during data writing: ... +POHMELFS is capable of full data channel encryption and/or strong crypto hashing. ...
    (Linux-Kernel)
  • Re: COBOL stored procedure for DB2
    ... The makefile will include appropriate build instructions for the stored procedure, ... exec sql begin declare section end-exec. ... Dim cmCallSP As Command ...
    (comp.lang.cobol)
  • Re: COBOL stored procedure for DB2
    ... for building and executing COBOL SP's using Object COBOL 4.1, ... Before building a stored procedure on AIX 4.2.1 using the Micro Focus 4.1 ... confirm the cob command used for creating the SP module. ... exec sql begin declare section end-exec. ...
    (comp.lang.cobol)