If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Automatically increasing field definition by SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-29-04, 06:32
anat_sher anat_sher is offline
Registered User
 
Join Date: Mar 2004
Posts: 21
Automatically increasing field definition by SQL

How can I create/define a field so it'll be of the automatically increasing type with a SQL sentence? If it must be done during table creation, that's cool too.

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-29-04, 06:38
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
Create table a
(
name varchar2(100)
);

Alter table a
modify name varchar2(200);
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.
Reply With Quote
  #3 (permalink)  
Old 03-29-04, 08:23
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Are you asking how to create a column that will increase in value, or increase in size? If you are looking to create something analagous to Oracle's rowid, the syntax is different for each database engine, so you'll have to tell us which engine you are using for us to give you one answer.

-PatP
Reply With Quote
  #4 (permalink)  
Old 03-30-04, 02:02
anat_sher anat_sher is offline
Registered User
 
Join Date: Mar 2004
Posts: 21
It's on ACCESS.
Reply With Quote
  #5 (permalink)  
Old 03-30-04, 05:24
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Quote:
Originally posted by anat_sher
It's on ACCESS.
That's helpful, but are you looking for an MS-Access AUTONUMBER column, or a TEXT column that will increase in length each time you do something?

-PatP
Reply With Quote
  #6 (permalink)  
Old 03-30-04, 05:41
anat_sher anat_sher is offline
Registered User
 
Join Date: Mar 2004
Posts: 21
AUTONUMBER please..

It's not on ACCESS really, it's on a SQL server. But I figured it's about he same. No?
Reply With Quote
  #7 (permalink)  
Old 03-30-04, 08:38
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
create table tableA
(
id INTEGER IDENTITY(1, 1)
...
)
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Last edited by r123456; 03-30-04 at 08:40.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On