Create a table with default value in a field and autonumber in primary key.
Posted on 2003-02-28
I'm using a C# program to create tables in MS SQL 2000 server database. This code is as follows:
Insert.CommandText = "CREATE TABLE " + test +
"(SettlementID INTEGER CONSTRAINT PKeyMyId PRIMARY KEY,"+
"RecordNumber INTEGER, TerminalNumber INTEGER, MerchantRegion INTEGER,"+
"MerchantOfferNumber INTEGER, TransactionDateTime DATETIME,"+
"TransactionSequenceNumber INTEGER, TransactionType VARCHAR(1),"+
"CardAccountNumber VARCHAR(14), TransactionAmount MONEY)" ;
object count = Insert.ExecuteNonQuery();
I need to be able to programatically set Identity:Yes for the primary key to make it autonumber and also I need to set the defaut value of MerchantRegion a certain number.
Does anyone has ideas?
PS Those are actually two questions, therefore you get more points :)