Click here to Skip to main content
Click here to Skip to main content

A Little Sqlserver Script Helper

, 17 Jan 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
When you want to get the data script from sqlserver, use this, it can be fun.


I found that it is hard to get data script from SQL Server 2005, so I made this little tool to do the job. You can update it in your own style. Have fun!

Step 1: Get the tables within the database.

Step 2: Get the data script by selected table.

Step 3: Copy the data to clipboard.

It's only raw code, more upgrades in the future.

This is GetFields() method to assemble the fields:

private string GetFields(Type t, object Value)
 string strLeft = "'";
 string strRight = "'";
 if (t == typeof(Int32) || t == typeof(int) || t == typeof(Int16) || t == typeof(Int64))
 return Value.ToString();

 if (t == typeof(string))
   return "N" + strLeft + Value.ToString() + strRight;
 return strLeft + Value.ToString() + strRight;

To get the tables within the dababase, use this:



  1. Add update script for single and multi table
  2. Add update and insert script for sync between source and destination databases

To use this, click More.

Start the main UI

Then click GenAll, by gen script between the 2 databases.

Sample screenshot

You can update it in your own style, then you'll get your script helper!

Thanks for your feedback!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Program Manager
China China
No Biography provided

Comments and Discussions

QuestionAre you Chinese? Pinmembersunweichao5-Feb-09 15:36 
AnswerRe: Are you Chinese? Pinmemberddrk5-Dec-13 21:44 
GeneralIt's easy to use! Pinmemberlemonex@163.com20-Jan-07 20:20 
GeneralA challenge... PinmemberESTANNY11-Jan-07 7:22 
GeneralRe: A challenge... Pinmemberddrk11-Jan-07 16:07 
GeneralSource code missing PinmemberTony Bermudez10-Jan-07 16:48 
QuestionRe: Source code missing Pinmemberddrk10-Jan-07 17:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150123.1 | Last Updated 18 Jan 2007
Article Copyright 2007 by ddrk
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid