Wednesday, November 16, 2005

Creating autonumbered Field in DDL

Here's how you can create an autonumbered field in Data Defination Language or DDL:
Sample:
CREATE TABLE tblTarget2
(TargetID COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,
[PECID] Long,
[BS] Long,
[D] Long,
[D1] Long,
[MPS] Long,
[D2] Long,
PEC TEXT(8),
Email TEXT(50))

This sample will create a table called tblTarget2 with the
TargetID field set as primary key and automated counter.


tblTarget
tblTarget2
TargetID PECID BS D D1 MPS D2 PEC Email
1 1






2 2






3 3







Reference: http://support.microsoft.com/?id=116145

No comments: