all groups > sql server data warehouse > october 2003 >
You're in the

sql server data warehouse

group:

Invalid Datetime


Invalid Datetime Henry Jartu
10/28/2003 11:03:15 AM
sql server data warehouse:
Somehow primary constraint was violated as group by
clause to eliminate dupplicates does not catch the
invalid date until attempt to insert data into
destination table:
Where clause produces the dupplicate row
"CONVERT(VARCHAR(50),sales_dt,101) = '10/23/2003'" but I
am unable to see the dupplicate and produces the two rows
2003-10-23 00:00:00.000
2003-10-23 00:00:00.000
However this where clause "sales_dt = '10/23/2003'"
eliminates the dupplicate in the result set and only
produces a single row
2003-10-23 00:00:00.000
Huge problem don't know which row to delete and primary
key is now violated on a table of over 120 million rows.
Running DBCC REINDEX fails now due to the violation in
primry key.

Re: Invalid Datetime anonymous NO[at]SPAM discussions.microsoft.com
10/28/2003 12:05:14 PM
Thanks for the sugesstion, I now get the two records but
still cannot physically see the difference. Do you or
anyone know of how to expose raw datetime data?
[quoted text, click to view]
Re: Invalid Datetime Adam Machanic
10/28/2003 2:12:52 PM
Try selecting WHERE sales_dt BETWEEN 10/22/2003 AND 10/24/2003

You probably have a 10-23 entry with a different time.


[quoted text, click to view]

Re: Invalid Datetime Henry Jartu
10/28/2003 2:19:32 PM
Thanks everyone it turns out that an aborted transaction
led to a corrupt index and therefore data was incorrect
results. I had to delete record, reindex and reload
record manually.

[quoted text, click to view]
Re: Invalid Datetime Adam Machanic
10/28/2003 3:49:56 PM
Check out DATEPART in BOL.

[quoted text, click to view]

AddThis Social Bookmark Button