schatz
asked on
Create a table with default value in a field and autonumber in primary key.
Hi folks,
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?
Thanks, Schatz
PS Those are actually two questions, therefore you get more points :)
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
"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?
Thanks, Schatz
PS Those are actually two questions, therefore you get more points :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER