I have a utility dll which modifies the schema of Sql Server and Ms-Access databases. In one case I need to add a temporary column to a table as an IDENTITY column (autonumber in Access) and then later delete it.
The following statement worked just fine on smaller databases, but when I ran it against a table with 80,000 records I got a timeout error.
ALTER TABLE tblTimeTable ADD TmpCol INT NOT NULL IDENTITY(1,1)
I copied the statement to QueryAnalyzer and it took 50 seconds, but it ran to successful completion. Why am I timing out via code?
Here is how I create the objects prior to use:
FqryColCreate := TADOQuery.Create(Nil);
ADOConnection1 := TADOConnection.Create(Nil);
ADOConnection1.LoginPrompt := false;
ADOConnection1.ConnectionString := sConnStr;
ADOConnection1.CommandTimeout := 50000;
FqryColCreate.Connection := ADOConnection1;
sSql := ALTER TABLE tblTimeTable ADD TmpCol INT NOT NULL IDENTITY(1,1)';