You are here: Scripting Databases « MsSQL Server « IT news, forums, messages
Scripting Databases

Posted by Ryan on 06/08/06 13:35

Is there an easy way to script the tables from within a database to
include the indexes etc...

Basically, if I want to script a number of tables, I can right hand
click on them and generate the script that way. What I'd like to do is
this same process in T-SQL if possible so I can build an SP which I can
then run.

It's really just a discussion point. Say we have a number of very
similar databases whereby there is a database per client and the
structure is almost the same. This was done for simplicity (rightly or
wrongly) and there is a fair amount of data.

When we take on a new client, we would need to take a copy of the
structure and create a new database with the tables from a known
'base'.

We would likely need a table to hold the names of the tables to include
from each database. We would then create an SP passing the name of the
database to copy from and one to copy to. This would then create a
script we can then automatically run to create a new database. Could
this be done in an SP where you pass these parameters, it creates
another SP with the script and then runs it ?

I've simplified some of this, so I hope it makes sense. It's not
something I would have normally done, but I'm curious how this problem
would be approached. Often people would take a script (or use a saved
one) and run that after manually creating the database.

Thanks in advance


Ryan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация