﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Export SQL data to a file / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 10:57:36 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Export SQL data to a file</title><link>http://www.sqlservercentral.com/Forums/Topic1422270-391-1.aspx</link><description>[quote][b]ajreynolds (2/20/2013)[/b][hr]I occasionally have need to export data from a MSSQL database to a file, copy the file to another server on a different network, then import the data from the file into a different MSSQL database.  In the past I've done this by exporting the data to an Access database file, but on newer machines with Office 2010, Access isn't included.  Sometimes I need to do large amounts of data from many tables, so using a flat file or Excel wouldn't work well.  What would be the recommended way to handle this sort of thing?Thanks,Andy[/quote]create a new databasecopy the tables to itdetach it/back it upcopy it to remote serverattach it/restore it copy data to desired locationThis can of course be scripted as well, just to make life simpler.</description><pubDate>Wed, 20 Feb 2013 16:47:43 GMT</pubDate><dc:creator>mister.magoo</dc:creator></item><item><title>RE: Export SQL data to a file</title><link>http://www.sqlservercentral.com/Forums/Topic1422270-391-1.aspx</link><description>Depending on what is meant by "copy the file to another server on a different network", bcp may run into permissions issues.I'd take a look at using SSIS for this and make a package to do the work for you. It may have a steeper learning curve than BCP but it can be more flexible.</description><pubDate>Wed, 20 Feb 2013 15:57:54 GMT</pubDate><dc:creator>Scott D. Jacobson</dc:creator></item><item><title>RE: Export SQL data to a file</title><link>http://www.sqlservercentral.com/Forums/Topic1422270-391-1.aspx</link><description>You should use bcp utility. It is included as apart of every SQL Server installation.  It is a command line utility, you specify what data is to be exported via command line parameters to a given file, then you can use bcp to bulk insert the same file to a table on the destination server.There are lots of command line option and you can look up the details in BOL but in the simplest case, going from SQL server to SQL Server you can use:output:bcp "select query" queryout destFilePath -k -N -Sserver -Tinput at destination:bcp  dbname.dbo.tablename in destFilePath -E -k -N -Sserver -T</description><pubDate>Wed, 20 Feb 2013 13:26:46 GMT</pubDate><dc:creator>sturner</dc:creator></item><item><title>Export SQL data to a file</title><link>http://www.sqlservercentral.com/Forums/Topic1422270-391-1.aspx</link><description>I occasionally have need to export data from a MSSQL database to a file, copy the file to another server on a different network, then import the data from the file into a different MSSQL database.  In the past I've done this by exporting the data to an Access database file, but on newer machines with Office 2010, Access isn't included.  Sometimes I need to do large amounts of data from many tables, so using a flat file or Excel wouldn't work well.  What would be the recommended way to handle this sort of thing?Thanks,Andy</description><pubDate>Wed, 20 Feb 2013 13:11:58 GMT</pubDate><dc:creator>ajreynolds</dc:creator></item></channel></rss>