If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Internal SQL Server Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-02, 03:48
J_P J_P is offline
Registered User
 
Join Date: Dec 2002
Location: Italy
Posts: 3
Red face 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 03:50.
Reply With Quote
  #2 (permalink)  
Old 12-06-02, 11:27
DBA DBA is offline
Registered User
 
Join Date: Oct 2002
Posts: 369
Question

What is the internal error e.g.(in the error log) you are receiving ?
Reply With Quote
  #3 (permalink)  
Old 12-06-02, 21:33
rnealejr rnealejr is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On