Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 OR expression in the WHERE Clause

Author  Topic 

boligoma
Starting Member

5 Posts

Posted - 2003-02-13 : 11:07:00
I have this query:

insert into Hours
(CnCveFolio, DxDescHorasRegistradas)
select cncvefolio, HorasRegistradas as DxDescHorasRegistradas
from temp_hexpediente where CdFechaRecepcion between '01/01/01' and '31/01/01' or (cncvefolio in (select cncvefolio from FechaCargaExpedientes))

and the Query Analizer returns the error 8623 saying that it has been an internal error because it can't create a consulting plan.

The select part returns me the values I want (If I exclude the insert into Clause). It also works if I eliminate the or part of at the end of the WHERE Clause. The three table exists (Hours, temp_hexpediente and FechaCargaExpedientes).

Any ideas???

thanks!

nr
SQLTeam MVY

12543 Posts

Posted - 2003-02-13 : 13:27:05
That error usually happens when you have an invalid query but the compiler hasn't spotted it - usually to do with group by's.

Is anything a view or do you have a trigger on the table?
Have you changed a table recently.
Is the database ok?

try
insert into Hours (CnCveFolio, DxDescHorasRegistradas)
select distinct cncvefolio, HorasRegistradas
from temp_hexpediente th
where CdFechaRecepcion between '01/01/01' and '31/01/01'
or exists (select * from FechaCargaExpedientes fce where fce.cncvefolio = th.cncvefolio)


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -