[thelist] SQL Server ALTER TABLE

Tab Alleman Tab.Alleman at MetroGuide.com
Wed Feb 18 08:26:28 CST 2004


>> I need to add a column to all tables (except system tables) in a SQL
>> Server DB. Is there a way to do:
>> 
>> <pseudocode>
>> ALTER TABLE * ADD [newcolumn] varchar (50)
>> WHERE [table] NOT [systemtable]
>> </pseudocode>

You might be able to do something with the undocumented stored procedure
(see your Master database) sp_Msforeachtable.  I've never used it
before, so I'm not sure if it will help you or not.


More information about the thelist mailing list