🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1476

Re: Auto Increment Question

#1476
From: Viatcheslav V. Vassiliev
Date: Thu, 01 Jul 2004 07:08
28 lines
1920 bytes
What it your DBMS? In MS SQL Server do:
CREATE TABLE Test (Col1 INT IDENTITY(1, 1) PRIMARY KEY)

The same syntax works for MS Jet (MS Access), as well as:
CREATE TABLE Test (Col1 COUNTER(1, 1) PRIMARY KEY)

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Kim Utley" <kim@simsware.com> �������/�������� � �������� ���������:
news:40e31878$1@newsgroups.borland.com...
> I have the need to use an autoincrement field in a database so the primary
> key will be unique. However I don't know the SQL syntax for it. I've tried
> "AUTO_INCREMENT", "AUTOINC" and "AUTO_INC" when creating the table fields
> but get a failure "Syntax error in field definition". Does anyone have a
> brief example of doing this or the syntax?
>
> Kindest Regards,
>
>
> Kim Utley
>
>
Technical Details
Message-ID: <40e3b857$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40e31878$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,7e1df2a336eac17
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <40e31878$1@newsgroups.borland.com>
Subject: Re: Auto Increment Question
Date: Thu, 1 Jul 2004 11:08:09 +0400
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 213.234.218.42
Message-ID: <40e3b857$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1088665687 213.234.218.42 (1 Jul 2004 00:08:07 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail