February 1, 2005 at 8:52 pm
Currently I open Query Analyzer,
right click on the table I want, left
click "Script object to new window as",
left click "Insert", and the database layout
script is generated.
How can I automatically generate the
following script from "data" that
is already in the table ?
CREATE TABLE test_table (FName nvarchar(100), LName nvarchar(100))
INSERT INTO test_table (FName, LName) values ('John','Doe')
INSERT INTO test_table (FName, LName) values ('Jane','Doe')
February 2, 2005 at 11:33 pm
You can get a tool or a stored procedure to do this. As part of our main product DB Ghost we give away a data and schema scripter which will create the insert statements for a table as well as schema scripting. There is also a link in the help file to a stored procedure (free) that can also be used. All you have to do is get the evaluation copy of DB Ghost and the data and schema scripter will install which is free and distributable which also includes a COM interface for programmers.
regards,
Mark Baekdal
+44 (0)208 241 1762
Database change management for SQL Server
February 3, 2005 at 6:53 am
http://vyaskn.tripod.com/code/generate_inserts.txt
a stored procedure which generates insert statements, complete with IDENTITY_INSERT ON/OFF for the primary keys, and lots of parameters to make it flexible.
HTH
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply