Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Data Export

Author  Topic 

josh2009
Yak Posting Veteran

81 Posts

Posted - 2009-07-22 : 17:38:43
We have laptops being used by our techs daily when they are out in the field. When they get back in the office, SQL data in these laptops need to be merged and synced back into the server. I have written a stored proc to sync the data between the prod server and the laptop data but I need a way to transfer the laptop data back into the prod server. The database name is different in the laptop but the table structures are identical. Is there a way for me to be able to export SQL out to a USB drive and plug it into Prod PC?
I was hoping that I wouldn't have to export to a different dbase such as MS Access. The reason being, I will also be writing code in Visual Studio for a user interface so the end-users wouldnt have to deal with importing data from the USB drive. Any help would be greatly appreciated. Thanks

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-23 : 04:25:25
You can export the data to flat files using BCP if you want, or you can use SSIS if the database name always stays the same or you use config files. This can then pump the data to your server as and when needed with a manual job that you or your user just starts.
Go to Top of Page

NewSQLMember
Starting Member

15 Posts

Posted - 2009-07-23 : 04:59:43
outputfile.txt "/t," that comma delimited

bcp dbname.dbo.tablename out /directory/outputfile.txt /U yourusername /P yourpassword /S servername\loginuser /c /t,
Go to Top of Page

josh2009
Yak Posting Veteran

81 Posts

Posted - 2009-07-23 : 09:51:37
Thanks I was able to export the data out to a text file and am in the process of trying to import it back in. I'll keep you posted
Go to Top of Page

josh2009
Yak Posting Veteran

81 Posts

Posted - 2009-07-23 : 10:02:22
Import went well too. Now is there a switch I can use with BCP so I don't have to enter through each field 3 times to accept the default? I'm trying to make this process as simple as possible for the users. Thanks.
Go to Top of Page
   

- Advertisement -