Is it possible to remove a Clustered Index from a table when you are using SQL Server 2005?
No, you can't remove a clustered index. You can choose to have the clustered index on any column, the default is the primary key.
The term clustered refers to the fact that the data in the table is physically stored in the pages on the hard drive in the order of the chosen clustered index.
The choices for the sort order should take the frequency of change of the data into consideration. So, clustering on a surname can cause a lot of disk activity when ever new names are entered into the table because the table needs to be restored and resorted every time that new data gets added in - unless you can guarantee that the names will always be consecutive - as in you can guarantee that for the next year you will only input surnames beginning with the A and then B's will follow the year thereafter ...
The primary key is not supposed to be used for business critical information since its primary purpose is to facilitate the referential integrity of your schema design. In Access you find that the AutoNumber field will lose a number that is not used, so you cannot rely on it for business purposes. You will often write a routine to create your own invoice numbers, quote numbers etc. And this is better column on which to create your clustered index.
I have tried and SQL server prevents me from doing it
As soon as you disable a clustered index you have done the equavilent of disabling the Master Boot Record of your computer. The only reason you can "see" any files on your computer is because the OS looks up the files details in the MBR. The only reason you can see any data in a table is because of the fact that the Clustered Index is what you are in fact reading.
I have a Table tblPeople that has a Clustered Index on Person_ID
, and I have a query that seems to be having problems because it wants to sort the table according to a calculated Last Name/First Name Field.
You can create a full text index on the last name & first name fields,but maybe a better approach is to create an index view, which would perform faster and can include a concatenated column along with a few other commonly searched for columns such as Social Security or Province
The query is having random locking issues that prevent users from using the application.
The best thing to do with random locking issues to monitor SQL Server using both SQL Profiler and SQL Server Management Studio (<InstanceName>-Management-Activity Monitor).
You will be able to see what process is causing the lock as well which user is busy at the time.
SQL Profiler will actually give you the full SQL code that caused the lock, giving you sufficient information to be able to trace the problematic queries.