65.9K
CodeProject is changing. Read more.
Home

To generate insert statement for user defined tables available in SQL Server 2000, through easy to use wizard.

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.50/5 (9 votes)

May 15, 2006

1 min read

viewsIcon

79132

downloadIcon

646

It will generate insert statement as per the tables selected by the user, and it also take cares of Identity inserts in the table.

Sample Image - GenerateSQLInsertScripts.gif
First Step


Second Step


Third Step

Introduction

By default SQL Server provides a facility to generate script for Database Objects. But their is no option offered by SQL Server to generate insert statements for the existing data in the tables. I faced this problem several times while creating application installer, I always had to ask someone to create insert statement for the master data or some data mandatory for application installation.

To overcome problem of manually generating Insert statements for SQL Server, I finally decided to build a wizard based utility that allows user to genrate insert scripts.

Using this tool

This tool is developed in C#, so we need to make sure we have Microsoft .Net Framework 1.1 installed on the system. It can generate sql scripts in 3 simple steps:

1. Enter connection detail for your SQL Server.

2. Select the tables, and organize them as per thier relation in the database i.e. Master should come first and then dependent tables to avoid refrential integrity error statements

3. Click on "Copy" button to copy generated statement to clipboard

Points of Interest

This component is as free as .Net Framework library.

History

1. Revised verson uploaded on 25-Jun-06  - To display truncate statements and handle UniqueIdentifier datatypes
2. Initial version added on 15-May'06