Please help me to create a Export like Export and Import Opttion in in SQL Server 2005
Thank u. But i want Sql Server Database to Sql Server DatabaseYa thak u .Second one .But i unable to under stand code.Could u help me to get it in easy way
kiran
2009-12-29 14:17:01
Thank u . Igot it
kiran
2009-12-29 14:25:46
Excuse me? Neither your question nor comments make any sense to me.
Peter Lindqvist
2009-12-29 14:25:56
Sounds to me like you want to be spoon fed everything instead of doing some trial and error. That is not what this site is here to do.
gmcalab
2009-12-29 14:26:26
+1 for understanding and answering this question. :)
Peter Lindqvist
2009-12-29 14:26:34
Sorry for that, i understand, what i want
kiran
2009-12-29 14:32:17
@gmcalab I agree with you, but I just wanna help. @kiran you should improve your English skills.
Michel Kogan
2009-12-29 14:34:42
Michel Kogan
2009-12-29 15:03:50
A:
SqlBulkCopy is the command that you want to use to import/export data to/from a SQL Server database. Here are a couple good articles with example code: www.codeproject.com/KB/database/Cs_CSV_import_export.aspx
www.davidhayden.com/blog/dave/archive/2006/05/31/2976.aspx
Bill W
2009-12-29 14:24:26
If one of the answers given gave you what you needed then you should "Accept" it. This will remove this question from the "Unanswered questions" list."To mark an answer as accepted, click on the check mark beside the answer to toggle it from hollow to green."
Bill W
2009-12-29 20:40:27
A:
Just send the needed sql statement to the server with a SqlCommand.ExecuteNonQuery()
.
For Backup:
BACKUP DATABASE [YourDatabaseName] TO DISK = N'FileName' WITH NOFORMAT, INIT, NAME = N'YourDatabaseName', SKIP, NOREWIND, NOUNLOAD, STATS = 10
For Restore:
RESTORE DATABASE [YourDatabaseName] FROM DISK = N'FileName' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 10
Or if you like just use (like already mentioned by others) the SqlBulkCopy class.
Oliver
2009-12-29 15:24:16