autoincrement question sql 2005 server

autoincrement question sql 2005 server

am 25.09.2007 15:06:32 von info

How add column autoincrement in sql server 2005 use SQL Server Management
Studio?

Tom

Re: autoincrement question sql 2005 server

am 25.09.2007 19:45:02 von giorgi.piero

On Sep 25, 6:06 am, "info"
wrote:

> How add column autoincrement in sql server 2005 use SQL Server Management
> Studio?

You just need to set the "Identity Specification" column for the
particular ID field to "Yes" in the table editor

P

Re: autoincrement question sql 2005 server

am 25.09.2007 22:56:10 von Erland Sommarskog

info (informatyk@fitness[CUT]authority.pl) writes:
> How add column autoincrement in sql server 2005 use SQL Server Management
> Studio?

For an existing column? That's a bit of work, because you need to copy
the table to a new definition. There is now ALTER TABLE command to add/drop
identiity. It may look simple in SSMS, but Mgmt Studio performs all that
drop affair behind your back. That would be OK if it knew how to do it,
but it doesn't, so if things go wrong you may mess up your database.

Of course, if you run SQL commands, you may mess the database on your
own as well, but at least you knew what you did.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx