[AccessD] Create table with autonumber and PK

Michael R Mattys michael.mattys at adelphia.net
Fri Jun 11 08:46:17 CDT 2004


John,
Does this work?
If not, would you take the code solution?

CREATE TABLE MemberDetails
(
    MemberId integer,
    FirstName varchar(50),
    LastName varchar(50),
    DateOfBirth date,
    Street varchar(100),
    City varchar(75),
    State varchar(75),
    ZipCode varchar(12),
    Email varchar(200),
    DateOfJoining date,
    CONSTRAINT PrimaryKey PRIMARY KEY(ID);
)

Michael R. Mattys
(724) 942-3437

Mattys MapLib for Microsoft MapPoint
http://www.mattysconsulting.com



----- Original Message ----- 
From: "jwcolby" <jwcolby at colbyconsulting.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Sent: Friday, June 11, 2004 9:14 AM
Subject: [AccessD] Create table with autonumber and PK


> Folks,
>
> I have a create table query that creates a table but does not set the PK
or
> setup the PK as an autonumber.
>
> CREATE TABLE MemberDetails
> (
>     MemberId integer,
>     FirstName varchar(50),
>     LastName varchar(50),
>     DateOfBirth date,
>     Street varchar(100),
>     City varchar(75),
>     State varchar(75),
>     ZipCode varchar(12),
>     Email varchar(200),
>     DateOfJoining date
>
> )
>
> Is it possible to do this?
>
> The ID should be a long, and should be set as an autonumber, and as the
PK.
> How do you do that in SQL?
>
> John W. Colby
> www.ColbyConsulting.com
>
>
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list