Click here to Skip to main content
12,759,971 members (32,237 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 10 Jan 2007

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

You may also be interested in...

Comments and Discussions

QuestionAre you Chinese? Pin
sunweichao5-Feb-09 15:36
membersunweichao5-Feb-09 15:36 
AnswerRe: Are you Chinese? Pin
ddrk5-Dec-13 21:44
memberddrk5-Dec-13 21:44 
GeneralIt's easy to use! Pin
lemonex@163.com20-Jan-07 20:20
memberlemonex@163.com20-Jan-07 20:20 
GeneralA challenge... Pin
ESTANNY11-Jan-07 7:22
memberESTANNY11-Jan-07 7:22 
GeneralRe: A challenge... Pin
ddrk11-Jan-07 16:07
memberddrk11-Jan-07 16:07 
GeneralSource code missing Pin
Tony Bermudez10-Jan-07 16:48
memberTony Bermudez10-Jan-07 16:48 
QuestionRe: Source code missing Pin
ddrk10-Jan-07 17:19
memberddrk10-Jan-07 17:19 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 18 Jan 2007
Article Copyright 2007 by ddrk
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid