I need to generate the data for a SQL Server database....

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 13-Oct-2004 11:02:28   

Hi there,

I need to generate the SQL inserts from some tables in my database (6 or seven tables). I'm 99.9% sure there'll be tools that can do this for me, does ayone know of any?

All I know is that TOAD willd do it for oracle, but I need the SQL Server ones....

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 13-Oct-2004 11:20:09   

Try SqlServer's Query Analyzer simple_smile

Right click table in object browser, script object to new window as --- insert. and it generates an insert statement.

(btw, the DB2 tools are even worse than oracle's)

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 13-Oct-2004 11:58:01   

Otis wrote:

Try SqlServer's Query Analyzer simple_smile Right click table in object browser, script object to new window as --- insert. and it generates an insert statement.

Not quite I wanted I'm afraid. I want it to generate the insert statements for all the data that is there - so if my table contains 10 records, then 10 INSERT INTO... statements are generated with the appropriate values. The idea is I can then pass this "test data" on to testers and other developers.

(btw, the DB2 tools are even worse than oracle's)

frowning Wow, thats quite a statement!!!!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 13-Oct-2004 12:27:39   

MattWoberts wrote:

Otis wrote:

Try SqlServer's Query Analyzer simple_smile Right click table in object browser, script object to new window as --- insert. and it generates an insert statement.

Not quite I wanted I'm afraid. I want it to generate the insert statements for all the data that is there - so if my table contains 10 records, then 10 INSERT INTO... statements are generated with the appropriate values. The idea is I can then pass this "test data" on to testers and other developers.

ah! simple_smile

You could export the data to an access db using MS DTS services (check 'export data' in teh enterprise manager, right mb on catalog) and the developers could then import the data using the same thing. You could also backup the database and the developers could restore the database on their boxes under a different name and then import the data into their own database using DTS, or you could 'publish' a replication batch and your testers would then simply subscribe to that batch. That last one is a bit complicated.

(btw, the DB2 tools are even worse than oracle's)

frowning Wow, thats quite a statement!!!!

It is. I've lost at least 3 days in development of the DB2 driver because of their horrible toolkit and even lesser documentation. The more you work with these big databases the more you don't understand why people keep buying these.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 13-Oct-2004 12:34:14   

Found exactly what I wanted:

http://www.dotnetspider.com/technology/KBPages/716.aspx

Thanks for your suggestions Frans, actually getting the tables exported as DTS packages is equally as effective, so maybe I'll just do that..

Posts: 497
Joined: 08-Apr-2004
# Posted on: 13-Oct-2004 12:36:31   

It is. I've lost at least 3 days in development of the DB2 driver because of their horrible toolkit and even lesser documentation. The more you work with these big databases the more you don't understand why people keep buying these.

They don't seem to care about the UI do they? Most of us developers just dont have the time to go and find out how to use cryptic tools to work with a database, I'm convinced that Oracle lose out a lot because of this. Whats the point of a ferrari engine if theres no steering wheel!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 13-Oct-2004 13:07:29   

MattWoberts wrote:

It is. I've lost at least 3 days in development of the DB2 driver because of their horrible toolkit and even lesser documentation. The more you work with these big databases the more you don't understand why people keep buying these.

They don't seem to care about the UI do they? Most of us developers just dont have the time to go and find out how to use cryptic tools to work with a database, I'm convinced that Oracle lose out a lot because of this. Whats the point of a ferrari engine if theres no steering wheel!

Exactly, which means you need an expensive person doing that steering for you. Which can be ok, but takes time as well.

For example, it is quite nice to have OleDbConnection.GetOleDbSchemaTable() retrieve some metadata for you. The convenience is: it's always in the same format, no matter which database you use. I can't get the OleDb driver for DB2 to work. it throws errors at me like "invalid command" or "missing parameter", I've tried every connection string type there is for db2, no luck. Fortunately their .NET provider works ok, so that's a plus, however I now have to query their own schema stuff and have to write for everything my own routines, again... simple_smile This requires writing test queries in their query tool, oh my... it doesn't even have undo haha simple_smile altering a view query? Nope, drop it and recreate it. it has a wizard but that doesn't work, i.e. it produces bad sql haha simple_smile .

And the database is so full of backwards compatibility stuff, it's mindblowing. For example they both support sequences AND identity columns. No-one knows when to use which, what's deprecated, and what's not, there are a alot of types not used anymore in the latest version, but of course still out there in the field....

And then the top of list: table aliasses of table aliasses of table aliasses of... simple_smile between schema's. Must be useful for something, however it's not clear to me what, or it must be an entry on thedailywtf! smile .

Ok, I'll stop now simple_smile you get the idea. Still it gets along ok. Almost done with the project creation part. Hopefully the DQE and templates are done at the end of the week.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 13-Oct-2004 22:58:01   

Sheesh! Must be why they're so unpopular. I don't think I know anyone at all that develops for DB2!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 13-Oct-2004 23:12:20   

Still they have the biggest database market share simple_smile Hard to believe, but these IBM marketeers sure know how to sell things smile

What's funny too is this: I installed a small version. I did pull some data out of the database, and I got weird "not enough temp table space availabel" errors... uhoh... Turns out, for each resultset produced, it apparently creates a cursor which is browsing through a paged set of data in a temp store on disk! smile

I really wonder how that meeting went:

CEO: "Hey Joe, the sales of the storage cabinet department are dropping, can you do something about it?" DB2 manager: "Sure, I'll ask the query processor guys to take care of it!"

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 14-Oct-2004 11:05:35   

wink Hehehe

Well, it makes life more interesting wink THink how boring it would be if we all just uses SQL Server, and it was always easy to do things - that would be terrible!! wink

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 15-Oct-2004 20:47:41   

Greetings Matt,

If you are still interested in finding a tool for

comparing and synchronizing the contents of two databases

then I used SQL data compare with great results. Its fast, reliable and does excatly what it advertises.

Only drwaback is its price (195$) but I found it worth the money SPECIALLY with its cousing (SQL compare for keeping database tables, views, SPs, ... in synch)

http://www.red-gate.com/SQL_Data_Compare.htm

Hope this helps

OMAR sunglasses