Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Italy
    Posts
    3

    Red face Unanswered: Internal SQL Server Error

    Well,
    i receive an Internal SQL Server Error when i try to
    execute this query under SQL Server 7.0 sp4:

    Code:
    Select	ordr.Articolo
    ,	Min(ordr.DtaPrevCon) as 'ConsegnaPrev'
    
    From
    	mxw.OFoRighe ordr inner join
    	mtws.vw_Articoli_Magazzino am on am.Articolo = ordr.Articolo and am.Deposito = 'SEDE'
    where
    	ordr.RigaAnn = 0
    and	ordr.GiaConsegn = 0
    and	ordr.TipoRiga = 3538947
    and	ordr.Quantita > 0
    and	((Select 
    		isnull(sum(ordr2.Quantita),0)+ordr.Quantita
    	From 	mxw.OFoRighe ordr2
    	Where
    		ordr2.RigaAnn = 0
    	and	ordr2.GiaConsegn = 0
    	and	ordr2.TipoRiga = 3538947
    	and	ordr2.Quantita > 0
    	and	ordr2.articolo = ordr.articolo
    	and	ordr2.idOrdFor < ordr.idOrdFor) + isnull
    (am.InMagazzino,0)) > 0
    Group By ordr.Articolo
    Order By ordr.Articolo
    This query normally run under sql server 2000 sp2.
    I have read some ms articles but i did found any solution
    to my problem. If i don't use any aggregate function and
    grouping records by first and second field, this error
    continue to be raised to me.
    I think there is a bug in the aggregate function (SUM)
    placed in the nested select query in the where clause
    which sum the quantity in the old product orders rows that
    the actual row.

    Practically,
    i had join a table with a view:

    [OFoRighe] (orders row table) which contains these columns:
    Order_id, Articolo (product_id and SKU), Quantita
    (Quantity), DtaPrevCon (DeliveryDate)

    [vw_Articoli_Magazzino] (this view select the availability
    of products in warehouse)
    Articolo (product_id and SKU), Deposito (warehouse
    location) , InMagazzino (actual available quantity,
    considering account orders. Therefore this value could be
    negative.)

    My problem? I need to know which is the first delivery
    date per product (if exists) considering all supplier
    orders and get the first date of the order that contains
    such quantity that summed to my availability is > 0.

    Excuse for my english, and thank to who read since here.
    JP
    Last edited by J_P; 12-06-02 at 04:50.

  2. #2
    Join Date
    Oct 2002
    Posts
    369

    Question

    What is the internal error e.g.(in the error log) you are receiving ?

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    Have you seen the following article - it seems to address the precise problem you are having:

    article

    If this does not fix your problem - please respond.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •