Saturday, February 25, 2012

add index

I know someone will refer me to online books, but I did a search on the
microsoft site and can't get to it.
I know the general format for adding an index is:
Alter Table tablename ADD INDEX indexname, type, FieldName
The thing is, I'm not sure what to put in for type? Do I use quotes? Can
someone actually give me an URL to an example that will show?
E. coli Happens.
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200512/1HockeyFan via webservertalk.com wrote:

> I know someone will refer me to online books, but I did a search on
> the microsoft site and can't get to it.
> I know the general format for adding an index is:
> Alter Table tablename ADD INDEX indexname, type, FieldName
> The thing is, I'm not sure what to put in for type? Do I use quotes?
> Can someone actually give me an URL to an example that will show?
Search for CREATE INDEX in BOL.
examples:
CREATE INDEX emp_order_ind
ON order_emp (orderID, employeeID)
CREATE UNIQUE CLUSTERED INDEX employeeID_ind
ON emp_pay (employeeID)
HTH,
Stijn Verrept|||>I know someone will refer me to online books, but I did a search on the
> microsoft site and can't get to it.
SQL 2000:
http://msdn.microsoft.com/library/e...portal_7ap1.asp
SQL 2005:
http://msdn.microsoft.com/en-us/library/ms130214(en-US,SQL.90).aspx

> Alter Table tablename ADD INDEX indexname, type, FieldName
Actually, I'm not sure where you got that syntax, it's...
CREATE [UNIQUE] [NON|CLUSTERED] INDEX
indexname
ON tablename (columnName [DESC] [, ...]);
SQL 2000:
http://msdn.microsoft.com/library/e...create_64l4.asp
SQL 2005:
http://msdn2.microsoft.com/en-us/library/ms188783.aspx

No comments:

Post a Comment