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 2008 Forums
 SQL Server Administration (2008)
 databe indexes inconsistent

Author  Topic 

liptolip
Starting Member

1 Post

Posted - 2011-06-01 : 10:17:28
I use sql server 2008.I added the index for some tables.But After a period of time I removed these index for to improve performance.After this, When I run the select query, data is not in the correct order.Thereon I detach database and attach different sql server 2008(on different computer). The data came in the correct order.

I run following t-sql for database maintenance:

ALTER DATABASE MyDatabase SET SINGLE_USER
GO
DBCC CHECKDB('MyDatabase ', REPAIR_ALLOW_DATA_LOSS)
GO
ALTER DATABASE MyDatabase SET MULTI_USER
GO

But CHECKDB did not solve the problem of.

As a result The data comes in the correct order on a different sql server.But data is not in the correct order on other sql server.
if the problem is caused by the database why query worked correctly on different SQL Server?

How do I solve this problem?
Thanks in advance...

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-01 : 10:20:42
>> data is not in the correct order
What do you mean by that? It's a relational database and data is not held in any order.
To retrieve data in an order you need an order by clause.

I suspect it was just coincidence that your system worked previously.

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

- Advertisement -