- From: "Ryan" <ryanofford@xxxxxxxxxxx>
- Date: 8 Jun 2006 06:35:15 -0700
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
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
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
- Prev by Date: Re: need information for "Before Select" Trigger
- Next by Date: Dump of databasse
- Previous by thread: need information for "Before Select" Trigger
- Next by thread: Re: Scripting Databases