title: How to generate SQL script pragmatically in c#
body: <p>I want to generate txt/sql file using c# code which will have "insert script" for all the table data available in database.
  E.g. My database name is "Test". It has two tables </p>
  
  <ol>
  <li><p>Employee </p></li>
  <li><p>Department.</p></li>
  </ol>
  
  <p><strong>Department data:</strong></p>
  
  <p><strong>ID</strong>  <strong>Name</strong><br/>
  1   Account</p>
  
  <p><strong>Employee data</strong></p>
  
  <p><strong>ID</strong>  <strong>Name</strong> <strong>DeptD</strong><br/>
     1      Ravi       1      <br/>
     6      Ripal      1        <br/>    </p>
  
  <p><strong>Now my c# code should generate txt/sql file with following content.</strong></p>
  
  <pre><code>USE [Test]
  GO
  SET IDENTITY_INSERT [dbo].[Department] ON 
  
  GO
  INSERT [dbo].[Department] ([ID], [Name]) VALUES (1, N'Account')
  GO
  SET IDENTITY_INSERT [dbo].[Department] OFF
  GO
  SET IDENTITY_INSERT [dbo].[Employee] ON 
  
  GO
  INSERT [dbo].[Employee] ([ID], [Name],  [DeptID]) VALUES (1, N'Ravi', 1)
  GO
  INSERT [dbo].[Employee] ([ID], [Name],  [DeptID]) VALUES (6, N'Ripal', 1)
  GO
  SET IDENTITY_INSERT [dbo].[Employee] OFF
  GO
  </code></pre>