Showing posts with label unique. Show all posts
Showing posts with label unique. Show all posts

Sunday, March 11, 2012

Bad Duplicate Records

we're running a query that returns duplicate records when it
_absolutely_ should not, that is, the data should have only unique
records. i remember reading some similar scenario that was either
service pack or dop related. this is only happening on one of our
boxes. this ring a bell w/ anyone? thanks,
arthurDuplicate records ring the bell of "using outer joins where not expected"
Kind of fuzzy for us to help you without any DDL / DML or sample data.
Jens Süßmeyer.
--
http://www.sqlserver2005.de
--
"arthur" <alangham@.gmail.com> schrieb im Newsbeitrag
news:1113512308.829100.162530@.g14g2000cwa.googlegroups.com...
> we're running a query that returns duplicate records when it
> _absolutely_ should not, that is, the data should have only unique
> records. i remember reading some similar scenario that was either
> service pack or dop related. this is only happening on one of our
> boxes. this ring a bell w/ anyone? thanks,
> arthur
>|||let me assure you, there are no outer joins. basically the query is:
select a.f2, b.f2
from a inner join b on a.f1 = b.f1
where a.f3 = y
if i run either
select * from a where f1 = x or select * from b where f2 = x
i only get one record. however when i join the two in the first query,
i get four records.|||But that are different queries.
Image the sample data
Table 1
=====f1 f2 f3
x x y
a u y
b u y
c u y
d u y
select * from a where f1 = x --> 1
Table 2
======f1 f2 f3
u x y
a a y
b b y
c u y
d u y
select * from b where f2 = y --> 1
> select a.f2, b.f2
> from a inner join b on a.f1 = b.f1
> where a.f3 = y
--> 4
Try checking your join !
HTH, Jens Süßmeyer
http://www.sqlserver2005.de
--
"arthur" <alangham@.gmail.com> schrieb im Newsbeitrag
news:1113516845.847086.23020@.g14g2000cwa.googlegroups.com...
> let me assure you, there are no outer joins. basically the query is:
> select a.f2, b.f2
> from a inner join b on a.f1 = b.f1
> where a.f3 = y
> if i run either
> select * from a where f1 = x or select * from b where f2 = x
> i only get one record. however when i join the two in the first query,
> i get four records.
>|||sorry, i should have left off the where a.f3 = y (or changed it to
where a.f1 = x) . my real query has a similar condition in it but does
not contribute to the duplicate records.
in any case, we're getting sidetracked. i am 100% sure there is nothing
wrong with the query - we have 2 boxes with the exact same data and one
returns duplicate data, the other doesn't.
like i said, i remember something about a bad service pack or dop
setting that causes this to happen.
arthur|||If you are concerned about processor settings try this:
Try adding
<SelectQuery>
OPTION (MAXDOP 1)
or look here if it doesn´t work
http://support.microsoft.com/kb/266372/EN-US/
HTH, Jens Süßmeyer
--
http://www.sqlserver2005.de
--
"arthur" <alangham@.gmail.com> schrieb im Newsbeitrag
news:1113593450.443922.169900@.l41g2000cwc.googlegroups.com...
> sorry, i should have left off the where a.f3 = y (or changed it to
> where a.f1 = x) . my real query has a similar condition in it but does
> not contribute to the duplicate records.
> in any case, we're getting sidetracked. i am 100% sure there is nothing
> wrong with the query - we have 2 boxes with the exact same data and one
> returns duplicate data, the other doesn't.
> like i said, i remember something about a bad service pack or dop
> setting that causes this to happen.
> arthur
>|||thanks! that got rid of the duplicate records. very odd since this is
not a complex query at all. do you know if this issue is related to any
service pack/hot fix?

Thursday, March 8, 2012

backupset

Here is my situation:
I have a stored procedure that runs full, differential and
log backups for a particular database.
Each backup has unique name based on the type, day of the
week and the time (e.g. Full_Backup_Monday_12-30).
Thus, backups are kept for one week.
When I review the backup set table, I see the name of my
backup, but in many cases I see an old date for the backup
and start and completion dates. However, when I review
the server, the newer backups are present.
My questions are:
Why isn't the backupset table being updated with the most
recent information?
When is the backupset table updated?
Thanks,
MichaelHi Michael,
Could you create a database backup as following steps?
1. Expand a server group, and then expand a server.
2. Expand databases, right-click the database, point to all tasks, and then
click backup database
3. Type the backup set name in the Name box and Select Database -complete
4. Under Destination, click Tape or Disk, and then specify a backup
destination.
If no backup destinations appear, click Add to add an existing backup
device or to create a new one.
5. Click Ok to create (Don't select the Schedule check box)
6. Check to see the backupset table again.
Is the backupset table updated immediately?
According to my test, the backupset table is updated on my side. When a
real backup finishes, a new record will be inserted in the table. Does it
work on your side? Generally, we do not recommended to directly query
system table. Could you tell me your detailed scenario?
This posting is provided "AS IS" with no warranties, and confers no rights.
Sincerely,
Michael Shao
Microsoft Support Engineer
| Content-Class: urn:content-classes:message
| From: "Michael" <michael_schall@.unionsanitary.com>
| Sender: "Michael" <michael_schall@.unionsanitary.com>
| Subject: backupset
| Date: Mon, 7 Jul 2003 16:51:46 -0700
| Lines: 22
| Message-ID: <06c801c344e2$b9f90bf0$a301280a@.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNE4rn5YC8MduACSZi2OM0YFuqZFQ==| Newsgroups: microsoft.public.sqlserver.server
| Path: cpmsftngxa09.phx.gbl
| Xref: cpmsftngxa09.phx.gbl microsoft.public.sqlserver.server:23185
| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.public.sqlserver.server
|
| Here is my situation:
|
| I have a stored procedure that runs full, differential and
| log backups for a particular database.
|
| Each backup has unique name based on the type, day of the
| week and the time (e.g. Full_Backup_Monday_12-30).
| Thus, backups are kept for one week.
|
| When I review the backup set table, I see the name of my
| backup, but in many cases I see an old date for the backup
| and start and completion dates. However, when I review
| the server, the newer backups are present.
|
| My questions are:
| Why isn't the backupset table being updated with the most
| recent information?
|
| When is the backupset table updated?
|
| Thanks,
| Michael
|