Written by:R Teachout5/14/2007 8:16 PM
Found on http://vyaskn.tripod.com/code.htm#inserts and archived on my site..
This procedure generates INSERT statements using existing data from the given tables and views. Later, you can use these INSERT statements to generate the data. It's very useful when you have to ship or package a database application. This procedure also comes in handy when you have to send sample data to your vendor or technical support provider for troubleshooting purposes. Generate Inserts Stored Procedure Script - Download by Clicking Here
Advantages:
Usage:
NOTE: Please see the code and read the comments to understand more about how this procedure works! To generate INSERT statements for all the tables in your database, execute the following query in that database, which will output the commands, that you need to execute for the same:SELECT 'EXEC sp_generate_inserts ' + '[' + name + ']' + ',@owner = ' + '[' + RTRIM(USER_NAME(uid)) + '],' + '@ommit_images = 1, @disable_constraints = 1' FROM sysobjects WHERE type = 'U' AND OBJECTPROPERTY(id,'ismsshipped') = 0
Note:
By default Query Analyzer (ISQLW) displays only 256 characters per line in the results tab. You can configure Query Analyzer to display a maximum of 8192 lines per line. Follow these steps: If you are using the Query Analyzer of Server 2000, go to Tools -> Options -> Results tab -> Enter the number 8192 in the "Maximum characters per column:" text box. If you are using the Query Analyzer of Server 7.0, go to Query -> Current Connection Options -> Advanced tab -> Enter the number 8192 in the "Maximum characters per column:" text box.
0 comment(s) so far...