db2 create table through the result set

If you want to create a table by the result set, you can use "create table as (select * from table_name) definition only" statement.

Now we open a new window DB2CLP, issue "CONNECT TO SAMPLE" command, even on the sample database SAMPLE, and then issued a "create table newtest1 as (select * from test1) definition only" command to create the table newtest1, its structure and test1 identical specific as shown in Listing 10:

Listing 10. Through the result set to create the table

C: \> db2 connect to sample

Database connection information

Database server = DB2 / NT 9.1.0
SQL authorization ID = RHETTE
Local database alias = SAMPLE

C: \> db2 create table newtest1 as (select * from test1) definition only
DB20000ISQL command completed successfully.

C: \> db2 select * from test1

ID
- - - - - - - - - - - - - - - - - - -
1
1
1
1
1

5 records have been selected.
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of db2 create table through the result set

  • SqlServer database connection pool to connect tomcat

    First, install the JDBC Driver The database driver jar file to put (Tomcat_install) \ common \ lib directory Second, configure the Connection Pool 1. Overall connection pool configuration, Tomcat in any Web application can be configured to use the co ...

  • Properties with 6 supplementary hibernate.cfg.xml configuration

    In some special circumstances, we may be saved in the database connection information config.properties document, for example, make a install.jsp to modify config.properties documents, implementation of online information on the database configuration. At

  • hibernate Technical Study Notes (first)

    Introduction: Model does not match (impedance mismatch) java object-oriented language, object model, its key concepts are: inheritance, association, polymorphism, etc.; database is the relational model, its key concepts are: tables, primary keys, for ...

  • The merits of the field-driven development

    All along, J2ee development process (in Struts + Hibernate + Spring as an example) are as follows: 1. Design Database 2. Generate database 3. From the project to establish database connection 4. Put the database reverse engineering to generate POJO 5 ...

  • hibernate call stored procedure

    hibernate call stored procedure

  • Based on Spring's Hibernate Search full-text search function of sample

    Database: Oracle 9i JDBC Driver: OJDBC14 Development Environment: Eclipse-JEE Spring version: Spring 2.0.6 Hibernate version: Hibernate Core 3.2.5/Hibernate Annotation 3.3.0/Hibernate Validator 3.0.0/Hibernate Search 3.0.0 Beta4 / / jdbc.properties (JDBC

  • Spring + Hibernate to use Glassfish Database Connection Pool

    applicationContext.xml file content <? xml version = "1.0" encoding = "UTF-8"?> <beans xmlns = " http://www.springframework.org/schema/beans " xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance " ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15

  • hibernate to use the principle of

    The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...

  • spring struts2.0 hibernate environmental structures .. despair carried out more than one hour only with good.

    http://www.qqread.com/java/2008/06/f413762.html Look here. . Note added myeclipse support spring when necessary add the commons-dbcp database connection pool package. And to add hibernate support. . Finally add struts2 support. . Oh the lazy point. . . fu

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries