Re: Help with Update Query

From: Chris2 (rainofsteel.NOTVALID_at_GETRIDOF.luminousrain.com)
Date: 02/14/05


Date: Mon, 14 Feb 2005 07:31:57 -0800


"winsa" <winsa@discussions.microsoft.com> wrote in message
news:D070EBF8-49CA-4DCC-9018-E57DFC90D5B4@microsoft.com...
> Hi
>
> Me again! This time need help with an Update Query. Here is my
code:
>

<snip>

>
> I'm not getting the correct values in the tbl_MSTRACC.OUTSTANDING
field.
> Can anyone see why, or maybe it's something else?
>
> Thanks.
>

winsa,

Ok, now I'm *certain* you're using MS SQL Server.

ALTER PROCEDURE dbo.sp_OUTSTANDING_UPDATE
AS
UPDATE dbo.tbl_MSTRACC
   SET tbl_MSTRACC.OUTSTANDING =
       tbl_OUTSTANDING.OUTSTANDING - tbl_OUTSTANDING.CURRPMNT
  FROM dbo.tbl_MSTRACC
      ,dbo.tbl_OUTSTANDING
 WHERE tbl_MSTRACC.DEBTOR_IDX = tbl_OUTSTANDING.DEBTOR_IDX

ALTER is used to change existing procedures (for corrections,
production updates). It wouldn't be something run normally (at least
I wouldn't imagine it would be). May I ask why this is ALTER
PROCEDURE?

As for the Update statement in the stored procedure, the syntax looks
ok at first glance (MS SQL Server was willing to successfully parse
the Update portion).

As for why you're not receiving correct values? It's impossible to
know without knowing what the sample data, expected results, and
actual results are.

(FYI: Many in microsoft.public.sqlserver.programming will want you to
provide the *full* DDL of the Tables, and the *full* INSERT scripts to
load the tables with sample data, in addition to all the Transact-SQL
involved.)

You can repost over to: microsoft.public.sqlserver.programming (which
would be the most appropriate on-topic course of action), or post your
DDL, INSERTS, and T-SQL here and I'll take a look at it.

Sincerely,

Chris O.



Relevant Pages

  • Re: Cursor problem
    ... I think the next step is for you to post full DDL and sample data ... along with the full stored procedure such that we can re-create the problem ...
    (microsoft.public.sqlserver.programming)
  • Re: Cursor problem
    ... NDA and can not post the DDL and data. ... You didn't post the stored procedure. ... identifiers within the sample data before posting it. ...
    (microsoft.public.sqlserver.programming)
  • Re: Programmatically changing a SQL view in a ADP
    ... solution is to the use of DoCmd.RunSQL, or to the use of DDL ("ALTER VIEW ... If it is the use of DDL that you don't like, ... Dim cn As ADODB.Connection ... Dim rst As ADODB.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: SQL tuning
    ... without DDL or sample data to go on). ... The expression in your WHERE clause all preclude the use of an index: ... ClientId is used in a function; ... For further advice, post at least DDL (create table statments, including ...
    (microsoft.public.sqlserver.programming)
  • Re: Access Crashes with CONTAINS in ServerFilter
    ... DDL in SQL ... > information about HowTo provide DDL and sample data) and ADP files. ... > Microsoft Developer Community Support ...
    (microsoft.public.access.formscoding)

Quantcast