hi Brian, thank you for the detailed explanation.
it looks like I might be able to write a SQL script that will iterate over all the tables in the database and generate a script to create those tables. I wonder if it will take column sizes (e.g. varchar(16)) and identity columns properly. I'll try it out. thanks again :) On Sunday, November 13, 2011 6:52:07 PM UTC-8, Brian wrote: > > You may be able to skip the manual table pre-creation by using CREATE > TABLE AS SELECT. > > 1.) Launch H2 ensuring the downloadable microsoft SQL Server JDBC > driver jar is in your CLASSPATH > 2.) in H2: CREATE LINKED TABLE > LNK_TBLNAME( > 'com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver:// > sqlserverhostname','sqlusername','sqlpassword','SqlDatabaseName.dbo.SqlTableName') > > > READONLY; > 3.) in H2: CREATE TABLE TBLNAME AS SELECT * FROM LNK_TBLNAME; > > If you're using a sql named instance append \INSTANCENAME to the URL > in the linked table stmt > If you're using windows authentication to mssql, then there's more > prep to do... > a.) ensure the appropriate auth dll bundled with the msjdbc driver is > acessible by H2 > b.) append ;IntegratedSecurity=true to the linked table jdbc URL > c.) use NULL without quotes for the sqlusername and sqlpassword > arguments. > > If you want to use a query instead of a table or view as the source, > just wrap it in parens and convert internal single quotes to two > single quotes to escape them. > > This is my favorite feature of H2 by far. > > Good luck! -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/R3bijmhdgx0J. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
