🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-sqlserver
Article #63

Re: Access counter type equivalent in SQL-Server 6.0

#63
From: Gordon A. Runkle
Date: Wed, 03 Apr 1996 00:00
15 lines
1369 bytes
John A. Simpson wrote:
> 
> I need to find out if there is some sort of equivalent to the Counter type in
> Access for SQL Server 6.0.  I already know about IDENTITY and TRIGGERs,
> however, both of these methods increment the counter field after the data is
> committed.  Our project is using the counter field as a foreign key so I need
> this field to be incremented before I commit the data.

Try using the @@IDENTITY global variable.  It 
tells you what the identity value is for the row 
just inserted.  Your stored procedure, or query 
batch, can then use this value in the foreign key 
of the related table.

Gordon.
Technical Details
Message-ID: <31633E10.428F@nationweb.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4jp2qv$puj@news1.i1.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 104de1,c59097bc5364613e
X-Google-Attributes: gid104de1,public
X-Google-Thread: 11acf5,c59097bc5364613e
X-Google-Attributes: gid11acf5,public
X-Google-Thread: 11355a,c59097bc5364613e
X-Google-Attributes: gid11355a,public
From: "Gordon A. Runkle" <gar@nationweb.com>
Subject: Re: Access counter type equivalent in SQL-Server 6.0
Date: 1996/04/03
Message-ID: <31633E10.428F@nationweb.com>
X-Deja-AN: 145709407
references: <4jp2qv$puj@news1.i1.net>
content-type: text/plain; charset=us-ascii
organization: NationWeb, Inc.
mime-version: 1.0
newsgroups: comp.databases.ms-sqlserver,bit.databases.mssql-1,bit.listserv.sqlinfo
x-mailer: Mozilla 2.01 (WinNT; I)