February 26, 2015 at 1:25 pm
Folks
Sometime back I had a superb stored procedure that I copied from site in the internet that could
1.) Create a bunch on insert statements ( you had to only pass the table name )
Anyone knows where I could find that ?
February 26, 2015 at 1:29 pm
maybe this one from Narayana Vyas Kondreddi?
I've been using a modified and renamed version of his for years.
Lowell
February 26, 2015 at 1:53 pm
Tried that web page. it is not there any more...
You can share yours if you like.
The only good thing is he had written in in such a way that it changes the values to OCTAL. This way he did not have to worry about the values that had single quote characters inside varchar fields.
February 26, 2015 at 2:11 pm
mw112009 (2/26/2015)
Tried that web page. it is not there any more...You can share yours if you like.
The only good thing is he had written in in such a way that it changes the values to OCTAL. This way he did not have to worry about the values that had single quote characters inside varchar fields.
not sure about octal, but the procedure usp_generate_inserts in this article:
http://qa.sqlservercentral.com/articles/T-SQL/66987/
builds hex strings for the values, maybe that's what you remember?
Lowell
March 1, 2015 at 7:53 pm
If you are not hung up on needed a stored proc to do this, you can very easily script the content of a database table as a set of INSERT statements using SSMS. Just right click on the database, select "Tasks" and then "Generate Scripts". In the window that pops up, select you table(s), click Next and then click the "Advanced" button. Scroll down to the second screen and you should see an option called "Types of data to script" and it will have a value "Schema only". Change it to "Data only" and then continue to the end of the wizard and you will have a script contain INSERT statements for all of the selected tables.
March 3, 2015 at 9:21 pm
It is up to you how you want to transfer data.
There are so many options available
You can use import/export wizard, SSIS, BCP ,script out data and run on other server, Linked server.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply