Solved

Export table structure and contents to .sql file

Posted on 2009-05-05
5
491 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

757 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

22 Experts available now in Live!

Get 1:1 Help Now