T
tiger79
Hi,
I'd like to create programmaticalyy some extra indexes in my database.
Here is one of my tables :
SqlCeEngine eng = new SqlCeEngine(@"Data Source=\My Documents\DICT.sdf");
eng.CreateDatabase();
SqlCeConnection con = new SqlCeConnection(@"Data Source=\My
Documents\DICT.sdf");
con.Open();
string DDL1 = "CREATE TABLE AttributeValues(AttributeId int not null,"
+ "Value int not null,"
+ "ValueLevel int not null,"
+ "Ordered int null,"
+ "Description nvarchar(128) not null,"
+ "ParentAttributeId int not null,"
+ "ParentValue int not null,"
+ "ParentValueLevel int null,"
+ "AttributeValuesIndex int null,"
+ "CREATE INDEX Descr ON AttributeValues(Description),"
+ "PRIMARY KEY (AttributeId, Value))";
//+ "CREATE INDEX Descr ON A
//+ "INDEX Descr (Description))";
//+ "FOREIGN KEY (AttributeId) REFERENCES Attributes(AttributeId) ON DELETE
CASCADE)";
SqlCeCommand cmdDDL1 = new SqlCeCommand(DDL1, con);
cmdDDL1.CommandType = CommandType.Text;
cmdDDL1.ExecuteNonQuery();
As u can see I've tried several ways but I just cant manage to get an
index...
I allso tried to make the table and create the index afterwards :
//SqlCeCommand insertCommand5 = con.CreateCommand();
//insertCommand5.CommandText = "CREATE INDEX Descr ON
AttributeValues(Description)";/*
Didn't works as well
Any idea when and how I can create a couple of extra indexes for a table ?
Thanks in advance...
I'd like to create programmaticalyy some extra indexes in my database.
Here is one of my tables :
SqlCeEngine eng = new SqlCeEngine(@"Data Source=\My Documents\DICT.sdf");
eng.CreateDatabase();
SqlCeConnection con = new SqlCeConnection(@"Data Source=\My
Documents\DICT.sdf");
con.Open();
string DDL1 = "CREATE TABLE AttributeValues(AttributeId int not null,"
+ "Value int not null,"
+ "ValueLevel int not null,"
+ "Ordered int null,"
+ "Description nvarchar(128) not null,"
+ "ParentAttributeId int not null,"
+ "ParentValue int not null,"
+ "ParentValueLevel int null,"
+ "AttributeValuesIndex int null,"
+ "CREATE INDEX Descr ON AttributeValues(Description),"
+ "PRIMARY KEY (AttributeId, Value))";
//+ "CREATE INDEX Descr ON A
//+ "INDEX Descr (Description))";
//+ "FOREIGN KEY (AttributeId) REFERENCES Attributes(AttributeId) ON DELETE
CASCADE)";
SqlCeCommand cmdDDL1 = new SqlCeCommand(DDL1, con);
cmdDDL1.CommandType = CommandType.Text;
cmdDDL1.ExecuteNonQuery();
As u can see I've tried several ways but I just cant manage to get an
index...
I allso tried to make the table and create the index afterwards :
//SqlCeCommand insertCommand5 = con.CreateCommand();
//insertCommand5.CommandText = "CREATE INDEX Descr ON
AttributeValues(Description)";/*
Didn't works as well
Any idea when and how I can create a couple of extra indexes for a table ?
Thanks in advance...