[dba-SQLServer] dba-SQLServer Digest, Vol 85, Issue 6

Arthur Fuller fuller.artful at gmail.com
Mon Mar 15 15:06:49 CDT 2010


Right-click the database name and you should see a "Script Objects" item.
>From there you can script the whole database including its tables, views,
sprocs, UDFs -- and even the insert statements to populate the tables. (I
vaguely recall that that feature is unavailable in some versions, but I
might be thinking of SQL 2005.

Incidentally, depending on requirements, I have developed a simple scheme
based on mdeldb. Because SQL creates a new database based entirely on the
contents of modeldb, I now have a collection of databases modeldb_xxxx,
where xxxx denotes the type of model I want. So I do a couple of quick
renames to select a new model, and then a simple New Database command and
presto, all nice and pretty.

I have used this to include a bunch of tables I will almost always want,
such as Contacts, Cities, Province/States and so on. Another version of
modeldb is aimed at typical order-entry systems. Another targets
time-and-billing apps.

I find that this works quite well.

hth,
Arthur

On Mon, Mar 15, 2010 at 3:54 PM, jwcolby <jwcolby at colbyconsulting.com>wrote:

> Copy database is not a choice.  Create is but that just creates a database
> of that name, it does not
> copy the objects themselves to the new database.
>
> John W. Colby
> www.ColbyConsulting.com
>
>



More information about the dba-SQLServer mailing list