?
Solved

auto number generation

Posted on 2003-03-10
7
Medium Priority
?
291 Views
Last Modified: 2008-02-26
hi there
 i am very new in sql database, actually i am trying to define one of my field as an  autonumber datatype and yes/no datatype, like which is available in ms access where we define our field as autonumber, n whenever a new records insert into database it will automatically incremented. and in yes/no field there is a sort of checkbox comes in the that field which returns boolean values..

Plz Hellp

0
Comment
Question by:SahdevSingh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Accepted Solution

by:
stiemark earned 200 total points
ID: 8109456
Use a long for autonumber with identity set.

For booleans, use bit fields (0/-1).


Mark
0
 
LVL 1

Expert Comment

by:annine
ID: 8109735
You can use "int" data type and set Identity = Yes, Identity Seed = 1, and Identity Increment = 1 for your field that you want to use as Autonumber in Access.

And you can use "bit" data type for your field that you want to use as Yes/No in Access.

Do I help you?
0
 
LVL 1

Expert Comment

by:carled
ID: 8109751
Why use a 'long' for the data type?  Most of the time an 'int' would be far more effective.  But, yes, setting it to an 'identity' type (in the table designer, down towards the bottom there is a field that allows you to do this) achieves the same effect as an 'Autonumber'.

A 'bit' data type is the equivalent of a 'yes/no' field.  Set it to 0 for 'No' and 1 for 'Yes'.  Depending on your application (ie asp, vb...) you may need to check this field for 1 or 0 rather than 'true' or 'false'.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:SahdevSingh
ID: 8110318
thankx to all of u
0
 

Expert Comment

by:CleanupPing
ID: 9276011
SahdevSingh:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 12

Expert Comment

by:monosodiumg
ID: 11092934
No comment has been added to this question in more than 257 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
   Accept: stiemark http:#8109456

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

monosodiumg
EE Cleanup Volunteer
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question