Unix Technical Forum

SqlServer2000: autonumbering records - how to ?

This is a discussion on SqlServer2000: autonumbering records - how to ? within the SQL Server forums, part of the Microsoft SQL Server category; --> I created table with "id" field as "uniqueidentifier" (primary key). I connect via ODBC from MS-Acces. -->>> Don't know ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 07:33 AM
netx
 
Posts: n/a
Default SqlServer2000: autonumbering records - how to ?

I created table with "id" field as "uniqueidentifier" (primary key).

I connect via ODBC from MS-Acces.
-->>> Don't know how to something like "Autonumber" in MS-Access.

Let me know If any trigger or something like this is required.
Please post some code of trigger if need.
Until now I have only developed some native MS-Access
databases. I hope there is some solution about "Autonumbering records"
in SQLServer.

SqlServer 2000, Access Xp.

Marek Bħbski



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 07:33 AM
David Rawheiser
 
Posts: n/a
Default Re: SqlServer2000: autonumbering records - how to ?

autonumber = identity

look it up in the books on line for examples and more info

"netx" <user72wytnij@go2.pl> wrote in message
news:423043e8$0$3231$f69f905@mamut2.aster.pl...
>I created table with "id" field as "uniqueidentifier" (primary key).
>
> I connect via ODBC from MS-Acces.
> -->>> Don't know how to something like "Autonumber" in MS-Access.
>
> Let me know If any trigger or something like this is required.
> Please post some code of trigger if need.
> Until now I have only developed some native MS-Access
> databases. I hope there is some solution about "Autonumbering records"
> in SQLServer.
>
> SqlServer 2000, Access Xp.
>
> Marek Bħbski
>
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 07:33 AM
Hugo Kornelis
 
Posts: n/a
Default Re: SqlServer2000: autonumbering records - how to ?

On Thu, 10 Mar 2005 13:59:10 +0100, netx wrote:

>I created table with "id" field as "uniqueidentifier" (primary key).
>
>I connect via ODBC from MS-Acces.
>-->>> Don't know how to something like "Autonumber" in MS-Access.

(snip)

Hi Marek,

The equivalent of Access' autonumber in SQL Server is the IDENTITY
property. For instance, to generate a surrogate key for invoices, you
could use

CREATE TABLE Invoices (InvID int NOT NULL IDENTITY,
CustID int NOT NULL,
Period smallint NOT NULL,
-- other columns,
PRIMARY KEY (InvID),
UNIQUE (CustID, Period),
FOREIGN KEY (CustID) REFERENCES Customers,
FOREIGN KEY (Period) REFERENCES InvoicingPeriods
)

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com