Monday, March 12, 2012

inconsistent query results

Using SS2000 SP3.
We run this query several times:
use tmxvesta_dev - -on maximus
select live,update_date,delete_cd,count(*)
from tbltelemarketing
where promo_code='1273701'
and delete_cd is null
group by live,update_date,delete_cd
and it brings back results where the delete_cd is not null and it brings
back a different delete_cd each time.
Any ideas on what could cause this?
I'm going to rebuild the indexes tonight but otherwise I don't know. I also
thought that I could try exporting the data, dropping the table, recreate the
table, import the data and rebuild the indexes. If just rebuilding the
indexes doesn't work, I'll try that. After that I'm out of ideas.
Thanks,
Dan D.
Dan,
Check the table using "dbcc checktable" and update statistics
(sp_updatestats or UPDATE STATISTICS) and space used (DBCC UPDATEUSAGE). If
your server has multiple processors (SMP) and "max degree of parallelism
Option" is configured to use more than one processor, then use the option
MAXDOP = 1 in the select statement.
AMB
"Dan D." wrote:

> Using SS2000 SP3.
> We run this query several times:
> use tmxvesta_dev - -on maximus
> select live,update_date,delete_cd,count(*)
> from tbltelemarketing
> where promo_code='1273701'
> and delete_cd is null
> group by live,update_date,delete_cd
> and it brings back results where the delete_cd is not null and it brings
> back a different delete_cd each time.
> Any ideas on what could cause this?
> I'm going to rebuild the indexes tonight but otherwise I don't know. I also
> thought that I could try exporting the data, dropping the table, recreate the
> table, import the data and rebuild the indexes. If just rebuilding the
> indexes doesn't work, I'll try that. After that I'm out of ideas.
> Thanks,
> --
> Dan D.
|||We check the db every night. There are no problems there. I rebuilt the
indexes last night but it didn't help. Do you know the syntax for the maxdop
option?
I tried this but it didn't like it.
use tmxvesta_dev
select live,update_date,delete_cd,count(*)
from tbltelemarketing OPTION (MAXDOP 1)
where promo_code='1273701'
and delete_cd is null
group by live,update_date,delete_cd
Thanks for your help and suggestions,
Dan D.
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> Dan,
> Check the table using "dbcc checktable" and update statistics
> (sp_updatestats or UPDATE STATISTICS) and space used (DBCC UPDATEUSAGE). If
> your server has multiple processors (SMP) and "max degree of parallelism
> Option" is configured to use more than one processor, then use the option
> MAXDOP = 1 in the select statement.
>
> AMB
> "Dan D." wrote:
|||I figured out how to use maxdop and it does give the correct answer.
Thanks.
Dan D.
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> Dan,
> Check the table using "dbcc checktable" and update statistics
> (sp_updatestats or UPDATE STATISTICS) and space used (DBCC UPDATEUSAGE). If
> your server has multiple processors (SMP) and "max degree of parallelism
> Option" is configured to use more than one processor, then use the option
> MAXDOP = 1 in the select statement.
>
> AMB
> "Dan D." wrote:

No comments:

Post a Comment