Author |
Topic |
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 15:57:51
|
Hi everyone!I have a table where 14 rows display out of sync with the other 1500 rows in the table for some reason. I have thouroughly checked the data in those rows and I can't see any reason for those rows displaying out of sync. I am new fairly new to SQL but am very confident that my queries are not at fault.However, I have run DBCC CHECKDB on the database and no errors came back. Does the fact that no errors were reported mean it's definately not corrupt? Is it worth running a repair anyway (I have never done a repair before so don't want to do one unless I have to)?Many ThanksLee |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-12 : 16:45:15
|
What do you mean "out of sync"?Wrong values? Not expected sequence? E 12°55'05.63"N 56°04'39.26" |
|
|
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 16:57:41
|
Hi PesoI haven't forgot to get back to you about the other question you answered for me (for which you were right and I apologise...but will answer that post seperately ASAP).Anyway, when I do a simply select * from tableX order by column. All 1500 records return in the correct order apart from just 14 records. I am able to update these records perfectly fine and they "function" OK. The rest of the database is also perfectly fine. It's just really strange how these particular 14 records return in the result out of sync. The 14 records concerned are all next to each other in the table ie, records 200 to 214 and they all return out of sync but in a block in the result. It's almost like these records are not affected by the ORDER by clause for some reason.Have you ever seen anything like this before?CheersLee |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-12 : 17:00:07
|
How did the records appear to be out of synch?Do you have a screen shot? Were there "hidden" characters? Ascii 160, for example? E 12°55'05.63"N 56°04'39.26" |
|
|
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 17:25:42
|
OK, I guess it must be my inexperience again! I have managed to get a correct result but still not sure why my original query causes the issue it does. I'm not sure if I can upload screen shots to this forum or even know how to??Anyway, the query that had the abnormality:SELECT ParentPath, Category, IDFROM tbl_dir_categoriesWHERE PID IS NOT NULLORDER BY ParentPathThis query works:SELECT ParentPath, IDFROM tbl_dir_categoriesWHERE PID IS NOT NULLORDER BY ParentPathNote that removing the Category from select allowed the 14 'odd' records to fall into line. Obviously that's not the right thing to do?? Just not sure why out of 1500 records, only 14 were out of sync. Does the order of selection of columns have any influence over sort order or anything? I didn't think it did.ThanksLee |
|
|
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 17:34:46
|
Hi PesoFurther to my last post, here is a sample output. It's the Computer Services categories....buy hey! Cutting and pasting into here..it looks likt there is a space there....hold on!Computers and Internet > Computer Services > Information TechnologyComputers and Internet > Computer Services > IT ConsultancyComputers and Internet > Computer Services > IT DisposalComputers and Internet > Computer Services > IT RecyclingComputers and Internet > Computer Services > IT Support ServicesComputers and Internet > Computer Services > Laptop RepairComputers and Internet > Computer Services > Server MaintenanceComputers and Internet > Computer Services > Server MonitoringComputers and Internet > Computer ConsumablesComputers and Internet > Computer Consumables > CD-DVD Duplication ServicesComputers and Internet > Computer Consumables > CD-DVD Media and PackagingComputers and Internet > Computer Consumables > CD-DVD PrintersComputers and Internet > Computer Consumables > Printer SuppliesComputers and Internet > Computer HardwareComputers and Internet > Computer Hardware > Computer PrintersComputers and Internet > Computer Hardware > Network HardwareComputers and Internet > Computer Hardware > PDAComputers and Internet > Computer ServicesComputers and Internet > Computer Services > Business SystemsComputers and Internet > Computer Services > Games Console RepairsComputers and Internet > Computer Services > Printer Repair |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-12 : 17:37:02
|
quote: Originally posted by LeeNewman
Computers and Internet > Computer Services > Information TechnologyComputers and Internet > Computer Services > IT ConsultancyComputers and Internet > Computer Services > IT DisposalComputers and Internet > Computer Services > IT RecyclingComputers and Internet > Computer Services > IT Support ServicesComputers and Internet > Computer Services > Laptop RepairComputers and Internet > Computer Services > Server MaintenanceComputers and Internet > Computer Services > Server MonitoringComputers and Internet > Computer ConsumablesComputers and Internet > Computer Consumables > CD-DVD Duplication ServicesComputers and Internet > Computer Consumables > CD-DVD Media and PackagingComputers and Internet > Computer Consumables > CD-DVD PrintersComputers and Internet > Computer Consumables > Printer SuppliesComputers and Internet > Computer HardwareComputers and Internet > Computer Hardware > Computer PrintersComputers and Internet > Computer Hardware > Network HardwareComputers and Internet > Computer Hardware > PDAComputers and Internet > Computer ServicesComputers and Internet > Computer Services > Business SystemsComputers and Internet > Computer Services > Games Console RepairsComputers and Internet > Computer Services > Printer Repair
Yes it is a space. E 12°55'05.63"N 56°04'39.26" |
|
|
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 17:38:52
|
When I cutted and pasted the sample into the post, there were spaces before the computer services category ....i'm sure there was. But as you can see there are not. I think i am going mad! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-12 : 17:40:46
|
This forum appearantly does not show multiple spaces.Including the text in tags [ code ] and [ /code ] <- without spaceswill display original text. E 12°55'05.63"N 56°04'39.26" |
|
|
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 17:44:18
|
YEEAAAAHHHHHH!Records updated and results coming back fine now.So all the problem was......was my eyesightThanks Peso! I guess i'll leave a database repair for another day |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-12 : 17:45:42
|
All your problem was bad data (leading space for 14 records. E 12°55'05.63"N 56°04'39.26" |
|
|
LeeNewman
Starting Member
16 Posts |
Posted - 2009-03-12 : 17:53:14
|
Come to think of it...it's still puzzling how the category column which was not affected by 'bad data' affected the results? The spaces were in the ParentPath column. When I excluded the Category from the SELECT the ParentPath returned in sync even with the spaces.Anyway, I'm not too worried as my actual problem is now solved. I just find it weird. |
|
|
|