-
Create Constraint Primary Key
Dear All
My application automaticaly create database and table when the first time
application run. But i can't create multiple primary key at my table, in
my source below i want to create WO_Number anda WO_Company as primary key.
....
CnDatabase=CreateObject("ADODB.Connection")
Cndatabase.Provider="SQLOLEDB"
....
SQL="Create Table [WO_DETAIL] (" & _
"[WO_Number] Varchar Not Null Default 'New' Primary Key," & _
"[WO_Company] Varchar Not Null Default 'New' Primary Key)"
Cndatabase.Execute SQL
Statement above appear error cannot create contraint primary key ...
Does any one know how to create multiple primary key on table
Thank's for you help
Gunawan
-
Re: Create Constraint Primary Key
G'day Gunawan.
Try this sql:
Create Table [WO_DETAIL] (
[WO_Number] Varchar(25) Not Null Default 'New' ,
[WO_Company] Varchar(25) Not Null Default 'New',
Constraint PK_WO_DETAIL Primary Key ([WO_Number],[WO_Company]))
Note that you will need to specify the size for the varchar fields (ie (25)),
or else the default size will be 1 I believe...
Cheers,
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks