Re: How to insert auto increment?



MN wrote:
Hi Expert,
How can I do this without enter 100 time every day?

insert into [tablename] (column1) values(1)
insert into [tablename] (column1) values(2)
....
insert into [tablename] (column1) values(100)
Thank you all for reply-MN

Why do you want to generate 100 rows per day if that's the only column?
Just increment a single value instead. If there are other columns
involved then maybe you can use an IDENTITY column.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

.



Relevant Pages

  • Re: How to insert auto increment?
    ... insert into [tablename] (column1) values ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: update 2 fields problem
    ... as the SQL Server optimizer will usually generate the ... This changes if the subquery has to be duplicated. ... order in which matches are found depends on the execution plan, ... still be affected by the UPDATE statement and the new values for Column1 ...
    (microsoft.public.sqlserver.programming)
  • Re: select distinct record only if certain column not null
    ... For instance, lets say column1 is a sample set, ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ...
    (comp.databases.ms-sqlserver)
  • Re: Date Query
    ... to display any records from the current date and greater then. ... SELECT Column1, Column2, ... ... I recommend posting to an Access group. ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: select distinct record only if certain column not null
    ... For instance, lets say column1 is a sample set, ... SQL Server you are using. ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)