Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Generate Alter script automatically in sql 2005

Author  Topic 

prasadsql
Starting Member

6 Posts

Posted - 2009-12-21 : 01:38:20

Hi,

I created database in sql server 2005. that contain many tables.
suppose I add columns in different tables. How can I add these
different column to my old database.
Suppose my old database at client side is Test, and I add different
column to different table at my server side database Test.
Then How to Generate Alter Script for New added columns in table at
my client side database Test, so I can run only Alter script to
add new column with data type to appropriate table at
client side.

If any one knows, then reply me soon.




GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2009-12-21 : 03:18:24
If you want to do it automatically, get a tool like Redgate's SQLCompare (other vendors probably have similar tools). Otherwise write the alter table scripts manually.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

sql-programmers
Posting Yak Master

190 Posts

Posted - 2009-12-21 : 11:08:37
Use the syntax for Add columns,

ALTER TABLE table_name
ADD column_name column-definition;

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page
   

- Advertisement -