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 Administration
 Backup/Restore MSSQL to/from txt files

Author  Topic 

duchino
Starting Member

3 Posts

Posted - 2010-03-20 : 14:30:21
Hi,

I need to backup MSSQL database to txt files, and restore the database from those files - using C#.

Please let me know if you have any idea.

MArcind

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-20 : 14:33:35
That isn't possible. Instead, you can export all of your objects via the GUI Generate Script wizard. To get the data out to text files, you can use bcp.exe or DTS/SSIS.

If you don't have the requirement of text files, then you can backup the database using BACKUP command and then restore it using RESTORE command. Both BACKUP and RESTORE commands are accessible in C#. There is no need to use text files.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-03-20 : 14:33:49
why not use native backup/restore?

anyway you can BCP the data out to text files
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-20 : 14:35:45




Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

duchino
Starting Member

3 Posts

Posted - 2010-03-20 : 14:38:25
It is possible. I have application (I don't have src) which performs backup/restore to/from txt files. I know BCP , but I need txt files.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-20 : 15:08:51
BCP does text files.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-20 : 15:09:31
What I'm saying isn't possible is backup/restore via txt files. SQL Server's backup/restore files are in native format.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

duchino
Starting Member

3 Posts

Posted - 2010-03-21 : 05:49:27
Can I convert MSSQL backup file (BCA) to txt and open via text editor to see data?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-21 : 12:58:49
No.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -