Solved

Export table structure and contents to .sql file

Posted on 2009-05-05
5
492 Views
Last Modified: 2012-05-06
What is the easiest way to export a table structure and the data to a .sql script to be run on other servers.  I need to distribute this to another organizaton, I would like them to just run the script.  Is it possible to do this in SSIS?
0
Comment
Question by:jasonbrandt3
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24308483
take a full backup and restore it on the other servers
0
 

Author Comment

by:jasonbrandt3
ID: 24308631
I realize I can backup the database and restore on the other servers.  What I want is a .sql script containing the table structure as in create table blah (.....)

with the data
insert into blah......

Hope that makes sense.  It's easily done in mysql by creating a dump file, I'd like to do something similar.
0
 
LVL 15

Accepted Solution

by:
Walter Ritzel earned 500 total points
ID: 24308659
If you are using SQL Server Management Studio, you can right click on the table, select menu Task and export the structure. Then, repeat the operation for the insert statements.
You can do both operations generate .sql files and use whenever you want.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 24308690
its not so easy as in MySQL, and requires more processor resource
0
 

Author Comment

by:jasonbrandt3
ID: 24319387
Just wanted to add a last comment, MS actually makes a free product for just this task, it's called the database publishing wizard which allows you to create dump files.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

914 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now