Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sql index

Posted on 2012-08-21
4
Medium Priority
?
705 Views
Last Modified: 2012-08-21
I have added a table to my sql. I created an "index" and make it a primary key. But for some reason it's not adding the next records automatically. Did I not create the index propertly?
0
Comment
Question by:Starquest321
4 Comments
 
LVL 15

Assisted Solution

by:Anuj
Anuj earned 668 total points
ID: 38315494
You mean Auto-Numbering? If so you must enable the Identity property for the new column. Indexes are not meant for this purpose, they are used for improving read performance of the queries.
0
 

Author Comment

by:Starquest321
ID: 38315530
ok perfect - where is that? How can I do it? I am using sql 2005
0
 
LVL 10

Accepted Solution

by:
gavsmith earned 668 total points
ID: 38315534
In the design of the table, check the fields extended properties for an 'Identity' property.
0
 
LVL 9

Assisted Solution

by:keyu
keyu earned 664 total points
ID: 38315600
other way is..

CREATE TABLE dbo.tblFoo  
(
id INT IDENTITY(1,1) PRIMARY KEY,
baz INT
)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

810 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