Hello,
I'm having a problem with a SQL 2K query. I keep getting an error message when using the Query Analyzer, "The server encountered a stack overflow during compile time." I have a table that has 800,000 + inventory records and I need to clean out some of them. However, I don't want to drop any records that are associated with a sales order because the inventory record is where the item description comes from. That's why even though some are over five years old and the qty avail is zero the description is still needed. This is my query.
select *
from parttable
where parttable.itemdate < 'Jan 1 2006'
and parttable.qtyavail < 1
and (parttable.itemno <> '7363317'
and parttable.itemno <> '7363703'
and parttable.itemno <> '7363710')
Only three itemno records related to sales orders are listed above, there are 6000+ of these records. When comparing the itemno's, if I use an "or" instead of "and" the query runs but the records do not kick out as needed. But when "and" is used the error message occurs. Once the query works I will change the select to a delete to get rid of the unwanted records. Can someone tell me what I'm doing wrong? Thanks Riley
I'm having a problem with a SQL 2K query. I keep getting an error message when using the Query Analyzer, "The server encountered a stack overflow during compile time." I have a table that has 800,000 + inventory records and I need to clean out some of them. However, I don't want to drop any records that are associated with a sales order because the inventory record is where the item description comes from. That's why even though some are over five years old and the qty avail is zero the description is still needed. This is my query.
select *
from parttable
where parttable.itemdate < 'Jan 1 2006'
and parttable.qtyavail < 1
and (parttable.itemno <> '7363317'
and parttable.itemno <> '7363703'
and parttable.itemno <> '7363710')
Only three itemno records related to sales orders are listed above, there are 6000+ of these records. When comparing the itemno's, if I use an "or" instead of "and" the query runs but the records do not kick out as needed. But when "and" is used the error message occurs. Once the query works I will change the select to a delete to get rid of the unwanted records. Can someone tell me what I'm doing wrong? Thanks Riley