Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL 2000 Alter Table not working in stored procedure... 1

Status
Not open for further replies.

Webkins

Programmer
Dec 11, 2008
118
US
Hello...
I am using SQL2000. The following code works just perfect in the Query Analyzer but fails when executed in a stored procedure:

ALTER TABLE partspec.dbo.double ADD auto_number INT identity

I am trying to insert a column with an automaticlly generated ID number. Any suggestions?

Thank you so very much.
 
Try this:

Exec ('ALTER TABLE partspec.dbo.double ADD auto_number INT identity')


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Why is an alter table command in a stored procedure? Stored procedures are generally run many times, but alter table statements tend to be run only once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top