hi friends I am going to create index on my database which contains different column like sal,age.But i got an error failedoperationexception error in index creation.
fail to create index "Id_Index".my code is
SqlConnection con = new SqlConnection(@"Data Source=MAHESH-F7B2934C\BABA;Initial Catalog=te;Integrated Security=True;Pooling=True");
ServerConnection sc = new ServerConnection(con);
Server srv = new Server(sc);
try{
Database db = srv.Databases["te"];
Table tb = new Table(db, "QRHDQ1");
if (tb != null)
{
Index id = new Index(tb, "Id_index");
id.IndexKeyType = IndexKeyType.DriPrimeryKey;
IndexedColumn indexedcol = new IndexedColumn(id, "id",true);
id.IndexedColumns.Add(indexedcol);
id.IsClustered = true;
id.Create();
}
Loading
VulpesPosted Sep 14, 2011, 10:49 AM
http://social.msdn.microsoft.com/Forums/en-US/sqlsmoanddmo/thread/c066e2f0-77d7-4c59-b396-85f7d413f037