<p>I have a database with a table Customers that have some data<br><br>
I have another database in the office that everything is the same, but my table Customers is empty<br><br>
How can I create a sql file in SQL Server 2005 (T-SQL) that takes everything on the table Customers from the first database, creates a, let's say, buildcustomers.sql, I zip that file, copy it across the network, execute it in my SQL Server and voila! my table Customers is full<br>
<br>
How can I do the same for a whole database?</p>

[{'answer_id': 20370, 'author': 'Bryan Roth', 'author_id': 299, 'author_profile': 'https://Stackoverflow.com/users/299', 'pm_score': 1, 'selected': False, 'text': '<p>You could always export the data from the Customers table to an Excel file and import that data into your Customers table.</p>\n\n<p>To import/export data:</p>\n\n<ol>\n<li>Right click on database</li>\n<li>Go to <strong>Tasks</strong></li>\n<li>Go to <strong>Import Data</strong> or <strong>Export Data</strong></li>\n<li>Change the data source to <strong>Microsoft Excel</strong></li>\n<li>Follow the wizard</li>\n</ol>\n'}, {'answer_id': 228896, 'author': 'Nordin', 'author_id': 29669, 'author_profile': 'https://Stackoverflow.com/users/29669', 'pm_score': 0, 'selected': False, 'text': '<p>If both databases resides in the same instance of SQL Server, ie use same connection, this SQL might be helpful:</p>\n\n<pre><code>INSERT INTO [DestinationDB].[schema].[table] ([column])\nSELECT [column] FROM [OriginDB].[schema].[table]\nGO\n</code></pre>\n'}, {'answer_id': 228957, 'author': 'Unsliced', 'author_id': 2902, 'author_profile': 'https://Stackoverflow.com/users/2902', 'pm_score': 5, 'selected': False, 'text': '<p>Use <code>bcp</code> (from the command line) to a networked file and then restore it. </p>\n\n<p>e.g. </p>\n\n<pre><code>bcp "SELECT * FROM CustomerTable" queryout "c:\\temp\\CustomerTable.bcp" \n     -N -S SOURCESERVERNAME -T \n\nbcp TargetDatabaseTable in "c:\\temp\\CustomerTable.bcp" -N -S TARGETSERVERNAME -T \n</code></pre>\n\n<ul>\n<li>-N use native types</li>\n<li>-T use the trusted connection </li>\n<li>-S ServerName</li>\n</ul>\n\n<p>Very quick and easy to embed within code. (I\'ve built a database backup(restore) system around this very command.</p>\n'}, {'answer_id': 1135529, 'author': 'The Matt', 'author_id': 121682, 'author_profile': 'https://Stackoverflow.com/users/121682', 'pm_score': 6, 'selected': False, 'text': '<p>This functionality is already built in to Sql Server Management Studio 2008. </p>\n\n<p>Just download <a href="http://www.microsoft.com/sqlserver/2008/en/us/trial-software.aspx" rel="noreferrer">the trial</a> and only install the client tools (which shouldn\'t expire). Use Management Studio 2008 to connect to your 2005 database (its backwards compatible).</p>\n\n<ol>\n<li>Right click your database</li>\n<li>Choose <strong>Tasks</strong> > <strong>Generate Scripts</strong></li>\n<li>Press Next, select your database again</li>\n<li>On the \'Choose Script Options\' screen, there is an option called <strong>Script Data</strong> which will generate SQL insert statements for all your data.</li>\n</ol>\n\n<p>(Note: for SQL Server Management Studio 2008 R2, the option is called "Types of data to script" and is the last one in the General section. The choices are "data only", "schema and data", and "schema only")</p>\n\n<p><img src="https://imgur.com/xM9nm.jpg" alt="alt text">\n<img src="https://imgur.com/wV1BV.jpg" alt="alt text"></p>\n'}, {'answer_id': 17552793, 'author': 'Able Alias', 'author_id': 602714, 'author_profile': 'https://Stackoverflow.com/users/602714', 'pm_score': 0, 'selected': False, 'text': '<p>For Data Expoer as SQL script in SQL server 2005, </p>\n\n<p><a href="http://blog.sqlauthority.com/2007/11/16/sql-server-2005-generate-script-with-data-from-database-database-publishing-wizard/" rel="nofollow">http://blog.sqlauthority.com/2007/11/16/sql-server-2005-generate-script-with-data-from-database-database-publishing-wizard/</a></p>\n'}, {'answer_id': 17586454, 'author': 'Lars Ladegaard', 'author_id': 2484902, 'author_profile': 'https://Stackoverflow.com/users/2484902', 'pm_score': 0, 'selected': False, 'text': "<p>I just like to add some screen shoots for Sql Server Management Studio 2008. It is correct to use the steps describe previously. When you have the 'Generate and Publish Script' -> 'Set Script Options' then press Advance to see script options:</p>\n\n<p>![Where to find Advanced script options]: image missing because I do not have the right reputation :(</p>\n\n<p>For Sql Server Management Studio 2008 the option to included data is 'Types of data to script'</p>\n\n<p>![Types of data to script]: image missing because I do not have the right reputation :( </p>\n"}, {'answer_id': 24492017, 'author': 'Milica Medic Kiralj', 'author_id': 2583780, 'author_profile': 'https://Stackoverflow.com/users/2583780', 'pm_score': 5, 'selected': False, 'text': '<p>You can check the following article to see how you can do this by using both SQL Server native tools and the third party tools: <a href="http://solutioncenter.apexsql.com/sql-server-bulk-copy-and-bulk-import-and-export-techniques/" rel="noreferrer">SQL Server bulk copy and bulk import and export techniques</a> </p>\n\n<p><em>Disclaimer: I work for ApexSQL as a Support Engineer</em></p>\n\n<p>Hope this helps</p>\n'}]
['https://Stackoverflow.com/questions/20363', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']