0

I am new to C# and SQL Server programming. I have a project in which I have to create a database backup automatically after every transaction. I tried SQL Server Agent jobs but unfortunately I came to know that in SQL Server 2014 Express, SQL Server Agent is not available.

Now I want to take a complete database script after every transaction in my C# application automatically. I found many ways of database script with data but all are through SQL Generate scripts Wizard. According to my need, I want an exact query that I run from C# application after every transaction and it creates a script in specific directory (replace if already exists). Thanks all.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Waqas Ali
  • 83
  • 1
  • 1
  • 11
  • Why not just enable snapshot isolation with `ALTER DATABASE MyDatabase SET ALLOW_SNAPSHOT_ISOLATION ON`: https://msdn.microsoft.com/en-us/library/tcbchxcb%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396. Seems essentially equivalent to your task. – Pieter Geerkens Jan 27 '16 at 04:15
  • 1
    This is a dumb requirement, because Sql Server already does this natively. They're called Transaction Logs. Make sure recovery mode is set to "Full" rather than "Simple", and do frequent T-Log backups. – Joel Coehoorn Jan 27 '16 at 04:23

1 Answers1

0

You can use Database class or Scripter class to specify objects you need to generate script for.

Previous Question 1

Previous Question 2

Community
  • 1
  • 1
Bassam Gamal
  • 713
  • 2
  • 8
  • 24