Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm working on a project where we are updating client databases from older version to newer versions of the database and the related schema.

I'm looking for a way do the following for all of the tables in the database that our program uses.

If the table doesn't exist
  create table
else
  for each column in the table
    bring the column up to date or create it

I can't seem to find a way to do this through management studio and I haven't turned anything up through Google.

Something that would either give me this option in SQL Management Studio or a program that would generate the scripts for me would be good.

Thanks.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can use tools like RedGates SQL Compare or Apex SQLDiff to compare and sync your schemas. It will compare the old and new database and generate the script for you.

share|improve this answer

I totally agree with DaniSQL's suggestions. But I would also add that this is something you can do via PowerShell and using SQLPSX would make it less difficult.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.