Re: altering a column of a table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: David Portas (REMOVE_BEFORE_REPLYING_dportas_at_acm.org)
Date: 01/03/05


Date: Mon, 3 Jan 2005 09:16:48 -0000

I suggest that ALL changes on a live system should be made through SQL
scripts rather than using Enterprise Manager / Wizards. That way you can
more reliably reproduce and test your installation process.

IDENTITY is the correct name for the "auto-incrementing" column property in
SQL Server.

You can ADD an IDENTITY column to a table using an ALTER TABLE statement:
ALTER TABLE YourTable ADD col INTEGER IDENTITY

You cannot add the IDENTITY property to an existing column. Enterprise
Manager achieves this by creating a new table with IDENTITY, repopulating it
with the old data and then dropping the old table. That's something you may
want to avoid doing on a production system. If you do want to use that
approach then use Enterprise Manager to change the column on a development
copy of your data and select the Save Change Script option to save the
commands to a file. That way you can see exactly what the steps are.

-- 
David Portas
SQL Server MVP
--


Relevant Pages

  • Re: altering a column of a table
    ... I suggest that ALL changes on a live system should be made through SQL ... scripts rather than using Enterprise Manager / Wizards. ...
    (microsoft.public.sqlserver.odbc)
  • Re: Scripting a SQL database
    ... With Enterprise Manager what is required to have the script create ... :> different SQL server and can it be done from ASP? ... programmatically without requiring the Admin to create it manually. ... scripts for me, which will help me learn but I don't know how to utilize ...
    (microsoft.public.inetserver.asp.db)
  • Re: Scripting a SQL database
    ... With Enterprise Manager what is required to have the script create ... :> different SQL server and can it be done from ASP? ... programmatically without requiring the Admin to create it manually. ... scripts for me, which will help me learn but I don't know how to utilize ...
    (microsoft.public.sqlserver.server)
  • Re: creating unique index and clustered index in sql server management studio
    ... Anything more should be done thru the Generate Scripts ... Andrew J. Kelly SQL MVP ... > SQL 2000 GUI created the indexes by creating a constraint while the new ... >>> Then the changes work and the code is genereted in the scripts. ...
    (microsoft.public.sqlserver.tools)
  • Re: Help Understanding mx.ODBC Error
    ... running the scripts on old data (that these scripts were able to digest ... Greg Corradini wrote: ... But recently they continue to bail on the mycursor.execute('An SQL ... Sent from the Python - python-list mailing list archive at Nabble.com. ...
    (comp.lang.python)