insert of an int column with identity specification set to yes, fails

Hello experts:

I'm trying to insert an int column
with identity specification = yes
identity increment and identity seed = 1.
There are about 600,000 records on the database.
Before I try to execute this, I went to tools, options, query execution,
sql server, general and checked to make sure
execution time out was set to 0.
When I execute it, I get a message that warnings were encountered during the
pre-validation process and might reuslt in a failure during save. Then it also
says something about this query will take a long time.
When I click yes it starts execution and after a few minutes
get a message:
Unable to modify table. Timeout expired.

Any help will be greatly appreciated.
 
lancerxeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh RetnakaranDatabase AdministratorCommented:
why dont you run like this
 
ALTER TABLE yourTableName ADD newColumnName int identity
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shannon_LowderCommented:
Your timeout issue may be caused by locking.  Can you confirm no one is running any queries against that table at the time you're trying to add the identity column?
0
lancerxeAuthor Commented:
That worked except it added it to the end of the table.
It has to be the 1st column.
How could I do that.
thanks
0
Aneesh RetnakaranDatabase AdministratorCommented:
it doesn't matter whether it is the first or last column, you can of cource mention the order in which the values should be returned on you select query
SELECT col10, col1, col3 from table
if you still wanna put it as the first column, you need to create a new table with the new structure, insert the values from the existing table and then drop the old table and rename the new table
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.