473,513 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unique filed

2 New Member
Hi all,
In an existing table I want to make a unique field and the values starting with 1 would be incremented by one till end of the filed. How to do it?
May 15 '07 #1
3 1048
frozenmist
179 Recognized Expert New Member
Hi,
Have an identity column when creating the table. It will auto increment the value with what is specified
identity(seed,increment)
seed is the first value and increment is by how much you want it incremented for the next row

eg:
CREATE TABLE TABLE1
(
id_num int IDENTITY(1,1),
name varchar (20),
)

Hope that helps
Cheers
May 15 '07 #2
rsnihar
2 New Member
Hi.. but I have an existing table.. wht to do in this case..



Hi,
Have an identity column when creating the table. It will auto increment the value with what is specified
identity(seed,increment)
seed is the first value and increment is by how much you want it incremented for the next row

eg:
CREATE TABLE TABLE1
(
id_num int IDENTITY(1,1),
name varchar (20),
)

Hope that helps
Cheers
May 15 '07 #3
frozenmist
179 Recognized Expert New Member
Hi,
You can user alter table and add a column
Expand|Select|Wrap|Line Numbers
  1. Alter table <tablename> add ID int identity(1,1)
  2.  
Hope it helps
Cheers
May 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1878
by: BO | last post by:
Hello, How we can change our cursor position for this issue: we are in Edit1 filed, when we click Enter (in Edit1 field) I want to be in Edit2 filed. How we can do it? Chris
6
341
by: VIJAY KUMAR | last post by:
I know RFV works(executes) on both Client side and server side. But if I want to execute only on Client Side due to performance reason then what I have to do? Ex: I have a Text box which must...
2
1293
by: Shiye | last post by:
Help...! Hi all, Does any of you know how can determine the default value of a filed to be taken from another feild (already filled) in the same row of the table??? Thanks, Shai
1
1231
by: Kay | last post by:
Hi I am using a listbox to view all my records in one of my tables. The problem I have is with the field "Streen Name". This is a lookup field from the table "streets" which contains all the...
2
1249
by: pawanez4u | last post by:
Hi All, This is Pavankumar, I am doing Attendance Management project in PHP. What i want is as a day increases i want to alter the table with new filed with name current date(i,e) 01 Nov 07 for...
3
3890
by: Yas | last post by:
Hi everyone I am trying to create a DELETE Trigger. I have 2 tables. Table1 and Table2. Table 2 has all the same fields and records as Table1 + 1 extra column "date_removed" I would like that...
11
7156
by: breal | last post by:
I have three lists... for instance a = ; b = ; c = ; I want to take those and end up with all of the combinations they create like the following lists
3
1236
by: Jackiegall | last post by:
Hi. I have only limited knowledge of Access 2007, as the database I use was created by a former employee - I just use it & have no idea how it works! There are approx 600 customer records in the...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7559
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.