Friday, February 24, 2012

create index

I need to check if an index available on table T1 and field F1. If not, create a non-clustered on F1. How can I do this in a stored procedure?

Something like this:
SELECTsc.name,*FROMsysindexkeys skJOINsyscolumns scON sk.colid = sc.colidand sk.id = sc.idWHEREsk.id =object_id('Activity')AND sc.name ='activityid'

No comments:

Post a Comment