?
Solved

Easy way to Load Data into tables?

Posted on 2005-04-24
2
Medium Priority
?
180 Views
Last Modified: 2010-03-19
Hi..

I wanted to know if someone can tell me the easiest way to load data into newly created tables.

Certain tables like "States", "Countries" i need to constantly reload and reload each time I create my databases.

I have maybe 10-20 tables that should have "canned" data in them when the tables are created.  I would like to have just one script that I can run that will populate the tables.

I suppose DTS could do something like this, but I was looking to have it all in one .sql file.

thx

-ws
0
Comment
Question by:Westside2004
  • 2
2 Comments
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13855377
One option that you can do is to create your "canned" tables in the model database.  Once it is there, everytime you create your database, it will automatically be created in your new database.  You don't have to create any script to do this because SQL Server will do it for you.

Hope this helps.
0
 
LVL 28

Accepted Solution

by:
rafrancisco earned 500 total points
ID: 13855387
Just to explain further, any object that exists in the model database will be automatically created in any new database within SQL Server.  So if you have your "States" and "Countries" table there, any new database will have these tables as well.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question