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.
| Author |
Topic |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-01-09 : 05:09:44
|
| I have a table where I am constantly doing searches based on the datetime and source.Will these queries work faster if I create indexes?if yes how do i create an index? The field is not unique. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-09 : 06:57:00
|
Basically yes, but also depends on how your queries are written. Certain conditions must be followed to enable optimizer to make use of indexes (e.g. avoiding non-SARGable expressions). Basic syntax for creating index is: CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name ON { table | view } ( column [ ASC | DESC ] [ ,...n ] ) Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-01-09 : 07:10:02
|
| can i change it from enterprise manager?what would i make it nonclustered or clustered? |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-09 : 07:14:41
|
| Yes, you can change it from EM as well as from QA. Making index clustered or non-clustered depends upon what type of data you have for the specified column. Read about Indexes in BOL to understand which type is best in which scenario.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|