Important alert: (current site time 7/15/2013 8:07:32 PM EDT)
 

winzip icon

UPDATED: Procedure to script your data (it generates INSERT statements for your existing data)

Email
Submitted on: 2/20/2001 2:38:38 AM
By: Narayana Vyas Kondreddi  
Level: Advanced
User Rating: By 8 Users
Compatibility: SQL Server 7.0
Views: 27007
author picture
(About the author)
 
     UPDATED with MORE features on 14th April 2001. This procedure generates INSERT statements using existing data from the given tables. Later, you can use these INSERT statements to generate the data. It's a kind of data scripting, just like scripting table structures. This procedure is very useful when you have to ship or package a database application, as you can use the INSERT scripts to copy the data. Advantages of this procedure: - No CURSORs are used - All datatypes are handled except images - NULLs are taken care of gracefully - Timestamp columns are taken care of - Identity columns are taken care of - Column names, table names, owner names with spaces are taken care of - Very flexible and configurable. Use the following 4 input parameters to customize the stored procedure: - @Target_Table - You can specisy an alternate table name - @Include_Column_List - You can either include or exclude the column list in the INSERT statement - @From varchar(800) - Use this parameter to filter the rows based on a filter condition (using WHERE) - @Include_Timestamp - Include or Exclude timestamp columns in the INSERT statement - @debug_mode - Displays the contents of the key variables for debugging purposes - @owner - To generate INSERTs for tables owned by non-DBO users - @ommit_images - to generate INSERTs excluding the image columns - @ommit_identity - to generate INSERTS excluding IDENTITY columns - @top - to generate INSERTs only for the TOP n rows in the table - @cols_to_include and @cols_toexclude to generate INSERTs by including or excluding specific columns. UPDATED VERSION OF THIS CODE CAN BE FOUND AT: http://vyaskn.tripod.com/code.htm
 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
--**************************************
-- for :UPDATED: Procedure to script your data (it generates INSERT statements for your existing data)
--**************************************
Copyright © 2001 Narayana Vyas Kondreddi. All rights reserved.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 7 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

2/28/2001 9:18:53 AMphilip hannent

Great Code that works well. Great job.
(If this comment was disrespectful, please report it.)

 
3/1/2001 1:46:52 AMkeu

Best code. i vote u 5 star. I am looking for this code so long already.thanks
(If this comment was disrespectful, please report it.)

 
3/30/2002 9:18:36 AMErnst

Super
(If this comment was disrespectful, please report it.)

 
11/6/2002 6:24:52 PM

This is the best code ever
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.