|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 8:33 AM
Points: 353,
Visits: 325
|
|
You have a really good script for this in this url:
http://vyaskn.tripod.com/code/generate_inserts.txt Written by: Narayana Vyas Kondreddi
I used a lot, its really nice!!! .
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 10:53 AM
Points: 1,662,
Visits: 1,709
|
|
Emito (5/14/2010)
You have a really good script for this in this url: http://vyaskn.tripod.com/code/generate_inserts.txt Written by: Narayana Vyas Kondreddi I used a lot, its really nice!!!  . Yes, the old script you mention has been used by many in the past. It does not handle some data types, such as image and varbinary(max). Additionally, that script has a while loop in it used just to get column names and their data types. Using the loop is not a good idea when you can use a rather simple select statement to do the work. I specifically mentioned in the beginning of the article that I am offering no cursors, no while loops, no bunch of single quotes solution to the task of generating insert statements.
My script also suffers from data type limitations, but this is only because of the small bugs in it. For example, I simply did not check floats and handling them requires small tweaks to the script. However, my script can potentially handle the data types which are not handled by the script to which you refer.
Oleg
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 2:14 AM
Points: 2,885,
Visits: 463
|
|
Hi,
Well, in SSMS 2008 R2 this feature (scripting data) is no longer available, so this solutions is usefull again .
Another option is to use this add-in to SSMS (it can scripting out table content): http://www.ssmstoolspack.com/.
Anyway, this solution is brilliant.
Regards
Slawomir Swietoniowski, MCITP:DBA+Developer (2005/2008)
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, March 01, 2012 3:16 PM
Points: 9,
Visits: 29
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, March 14, 2013 4:15 AM
Points: 3,240,
Visits: 4,960
|
|
Nice Article. Very helpful.
Thanks.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sometimes, winning is not an issue but trying. You can check my BLOG here
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, April 15, 2013 1:33 AM
Points: 31,
Visits: 261
|
|
Nice script !!! I suggest a small improving, special handling not only of text datatype but also of ntext
when 'ntext' then 'cast([' + column_name + '] as nvarchar(max))'
You can update your script with it
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 12:24 PM
Points: 908,
Visits: 1,671
|
|
Slawomir Swietoniowski (5/14/2010)
Hi, Well, in SSMS 2008 R2 this feature (scripting data) is no longer available, so this solutions is usefull again  . Another option is to use this add-in to SSMS (it can scripting out table content): http://www.ssmstoolspack.com/. Anyway, this solution is brilliant. Regards
Slawomir,
The scripting data feature is still available in SSMS 2008 R2, but it appears to be under a different heading from SSMS 2008. The property option is now available under the "General" header and called "Type of data to script". It has 3 options in the drop down: Data Only, Schema and data, Schema Only. For those not aware, you can get to the scripting: by right clicking the mouse on a database, Tasks > Generate Scripts... > Choose "Select specific database objects" > Select the tables you want to script > then select the "Advanced" button to get to the "Type of data to script" property.
Thanks, John D
|
|
|
|