jwcolby
jwcolby at colbyconsulting.com
Sat Sep 3 11:11:10 CDT 2011
That is cool. Now if they would allow us to create different model databases and specify a model when creating a new database... I have stuff for my Access Presentation level Security System - tables with existing data and so forth. I only use that for Access databases obviously. The way I have done this in the past was to create a template with all the stuff. Then do a database copy of the template to the BE that I am just starting to develop. In this case I have existing databases where I need to graft in some more of my PLSS stuff. IOW I had some of it but not all. I am just using the import data wizard to do them for the one I am working on now. I just thought I wouold build these stored procedures to allow me to create the ones missing "on demand". the creation of the tables was fairly trivial but now I need to do template data. John W. Colby www.ColbyConsulting.com On 9/3/2011 11:44 AM, Arthur Fuller wrote: > A little-appreciated feature of SQL Server is the model database. Its name > describes its function. Every database you create is based on model. All the > tables, all the rows, all the sprocs, all the UDFs, all the triggers are > copied from model to your new database. > > I have played with this and I love this feature. Of course, I first copied > the vanilla model to a new database called Vanilla_Model, then I imported a > number of common tables (Customers, States, Provinces, etc.) into model and > finally created a new database. Lo and behold, everything I added to model > was automagically present in the new db. > > If you don't want to take this approach, you can still generate scripts > including the insert statements. Open Management Studio, open the tables > list and right-click. If you do so on the Tables list, as opposed to a given > table, you can script them all at once, into individual files or one giant > file containing everything. > > HTH, > Arthur > > On Sat, Sep 3, 2011 at 11:19 AM, jwcolby<jwcolby at colbyconsulting.com>wrote: > >> I am building scripts (stored procedures) to create tables from a template >> database into another database. >> >> I have data in these table that I need to script to be inserted into the >> resulting tables created in the first . Is there generic syntax to do that >> or do I need to build a hard coded insert sql statement for each one? >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > >