|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to get table data ?Hi!
I'd like a tool that will generate Insert statements for my whole table with data. What tool is best for this job ? Jarod Jarod wrote:
> Hi! I just put up a rough script that I use for this...> I'd like a tool that will generate Insert statements for my whole table > with data. What tool is best for this job ? > Jarod http://realsqlguy.com/serendipity/archives/15-Table-For-Two.html >> Hi! But what I really need is a script or program that will generate data from >> I'd like a tool that will generate Insert statements for my whole table >> with data. What tool is best for this job ? >> Jarod > > I just put up a rough script that I use for this... > http://realsqlguy.com/serendipity/archives/15-Table-For-Two.html > table as INSERT statements so: INSERT INTO EMPLOYEES VALUES(1, 'John', NULL, 10, 10) and so on. So if I have Employees table I'll get a whole list of INSERT INTO ... Jarod Jarod wrote:
Show quote >>> Hi! Ummm, did you look at the script? That's exactly what it does...>>> I'd like a tool that will generate Insert statements for my whole >>> table with data. What tool is best for this job ? >>> Jarod >> >> I just put up a rough script that I use for this... >> http://realsqlguy.com/serendipity/archives/15-Table-For-Two.html >> > > But what I really need is a script or program that will generate data > from table as INSERT statements so: > INSERT INTO EMPLOYEES VALUES(1, 'John', NULL, 10, 10) > > and so on. > So if I have Employees table I'll get a whole list of INSERT INTO ... > Jarod I think what the OP is asking for is a text file containing the input
statements, whereas your script actually executes the statements. The following change, I think, will do it. change EXECUTE (@SQLCmd) to execute sp_executesql N'Select @Insert,' N'@Insert nvarchar(4000)', @Insert= @SQLCmd Show quote "Tracy McKibben" <tr***@realsqlguy.com> wrote in message news:44FECDAB.4000909@realsqlguy.com... > Jarod wrote: > >>> Hi! > >>> I'd like a tool that will generate Insert statements for my whole > >>> table with data. What tool is best for this job ? > >>> Jarod > >> > >> I just put up a rough script that I use for this... > >> http://realsqlguy.com/serendipity/archives/15-Table-For-Two.html > >> > > > > But what I really need is a script or program that will generate data > > from table as INSERT statements so: > > INSERT INTO EMPLOYEES VALUES(1, 'John', NULL, 10, 10) > > > > and so on. > > So if I have Employees table I'll get a whole list of INSERT INTO ... > > Jarod > > Ummm, did you look at the script? That's exactly what it does... > > > -- > Tracy McKibben > MCDBA > http://www.realsqlguy.com Jim Underwood wrote:
> I think what the OP is asking for is a text file containing the input Nope. My script builds a temporary stored proc, executes that proc, > statements, whereas your script actually executes the statements. > > The following change, I think, will do it. > > change > EXECUTE (@SQLCmd) > to > execute sp_executesql > N'Select @Insert,' > N'@Insert nvarchar(4000)', > @Insert= @SQLCmd > producing a list of INSERT statements that can be saved to a file, copy/pasted, whatever. The EXECUTE statement that you're referring to executes a dynamic SELECT statement that produces each INSERT statement returned by the proc. GAH! never mind...
I shoudl never post before my first cup of coffee. That is exactly what the script is doing. Show quote "Jim Underwood" <james.underwoodATfallonclinic.com> wrote in message news:ecP18sb0GHA.1256@TK2MSFTNGP02.phx.gbl... > I think what the OP is asking for is a text file containing the input > statements, whereas your script actually executes the statements. > > The following change, I think, will do it. > > change > EXECUTE (@SQLCmd) > to > execute sp_executesql > N'Select @Insert,' > N'@Insert nvarchar(4000)', > @Insert= @SQLCmd > > > "Tracy McKibben" <tr***@realsqlguy.com> wrote in message > news:44FECDAB.4000909@realsqlguy.com... > > Jarod wrote: > > >>> Hi! > > >>> I'd like a tool that will generate Insert statements for my whole > > >>> table with data. What tool is best for this job ? > > >>> Jarod > > >> > > >> I just put up a rough script that I use for this... > > >> http://realsqlguy.com/serendipity/archives/15-Table-For-Two.html > > >> > > > > > > But what I really need is a script or program that will generate data > > > from table as INSERT statements so: > > > INSERT INTO EMPLOYEES VALUES(1, 'John', NULL, 10, 10) > > > > > > and so on. > > > So if I have Employees table I'll get a whole list of INSERT INTO ... > > > Jarod > > > > Ummm, did you look at the script? That's exactly what it does... > > > > > > -- > > Tracy McKibben > > MCDBA > > http://www.realsqlguy.com > > Jim Underwood wrote:
> GAH! never mind... Yep! :-)> I shoudl never post before my first cup of coffee. > > That is exactly what the script is doing. > The script needs some cleanup, commenting, etc., but I just threw it up quickly when I saw the original question this morning. Hi,
This is wonderful script from Vyas. http://vyaskn.tripod.com/code/generate_inserts.txt Thanks Hari SQL Server MVP Show quote "Jarod" <blueice@NOSPAM.gazeta.pl> wrote in message news:u2QL89a0GHA.4772@TK2MSFTNGP03.phx.gbl... > Hi! > I'd like a tool that will generate Insert statements for my whole table > with data. What tool is best for this job ? > Jarod Qualite is a free utility that will generate insert statements
and has many other features. http://www.rac4sql.net/qalite_main.asp best, steve http://racster.blogspot.com |
|||||||||||||||||||||||