January 24, 2012 at 9:15 pm
When creating a table
how do make the FieldID auto increment
Create table(
PostID int Primary auto increment
...
)
January 24, 2012 at 9:26 pm
kirkdm01 (1/24/2012)
When creating a tablehow do make the FieldID auto increment
Create table(
PostID int Primary auto increment
...
)
You are refereing to identity columns.
Please google about identity columns.
Create table RunningId (intSlno int Identity(1,1), Name varchar(100))
This table will create will running number for intSlno column.
-- Babu
January 24, 2012 at 10:47 pm
January 24, 2012 at 10:56 pm
CREATE TABLE dbo.Test
(
PostID integer IDENTITY PRIMARY KEY
);
See also these topics in Books Online (The SQL Server Help Library):
Creating and Modifying Identifier Columns
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
January 24, 2012 at 10:59 pm
create table tablename( column name int identity(1,1))
identity refers auto increment first one refers from which number u has to start and the second one tells how much u need to increment
for example
create table tablename( column name int identity(100,10))
it starts from 100 and increments by 10
100
110
120 like this
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply