Generate Create Table Statements

Hi, the problem is:
My company want to migrate our SQL Server DB to Winwows Azure Server (currently we have our own domain and server), but Azure doesn't support the sentence 'Into' to create temporary tables, so we should replace all 'Into' sentences to corresponding 'Create
Table' statements. Our system have up 1000 SP's with 'Into' sentences and many SP's have a lot of them.
My question: is possible generate a 'Create Table' statement automatically, from a 'select into' sentence? i want to know if Management Studio or external tool have this feature o something similar.
Sorry for my poor english but this is not my native language.
Thanks!

Try this one on for size. Run it against your existing DB. It'll give you create scripts you can use on your new DB.
WITH allCols AS (
SELECT s.name as sName, o.name AS oName, c.name AS cName, column_id,
CASE WHEN st.name in ('float','bigint','tinyint','int','smallint','bit','datetime','money','date','datetime2','uniqueidentifier','sysname','geography','geometry') THEN st.name
WHEN st.name in ('numeric','real') THEN st.name + '('+CAST(c.scale AS VARCHAR)+','+CAST(c.precision AS VARCHAR)+')'
WHEN st.name in ('varbinary','varchar','binary','char','nchar','nvarchar') THEN st.name + '(' + CAST(ABS(c.max_length) AS VARCHAR) + ')'
ELSE st.name + ' unknown '
END + ' '+
CASE WHEN c.is_identity = 1 THEN 'IDENTITY ' ELSE '' END +
CASE WHEN c.is_nullable = 0 THEN 'NOT ' ELSE '' END + 'NULL' AS bText,
f.name AS fileGroupName
FROM sys.columns c
INNER JOIN sys.objects o
ON c.object_id = o.object_id
AND o.type = 'U'
INNER JOIN sys.systypes st
ON c.user_type_id = st.xusertype
INNER JOIN sys.schemas s
ON o.schema_id = s.schema_id
INNER JOIN sys.indexes i
ON o.object_id = i.object_id
AND i.index_id = (SELECT MIN(index_id) FROM sys.indexes WHERE object_ID = o.object_id)
INNER JOIN sys.filegroups f
ON i.data_space_id = f.data_space_id
), rCTE AS (
SELECT sName, oName, cName, column_id, CAST(cName + ' ' + bText AS VARCHAR(MAX)) as bText, CAST(cName AS VARCHAR(MAX)) AS colList, fileGroupName
FROM allCols
WHERE column_id = 1
UNION ALL
SELECT r.sName, r.oName, r.cName, c.column_id, CAST(r.bText +', ' + c.cName + ' ' +c.bText AS VARCHAR(MAX)), CAST(r.colList+ ', ' +c.cName AS VARCHAR(MAX)), c.fileGroupName
FROM allCols c
INNER JOIN rCTE r
ON c.oName = r.oName
AND c.column_id - 1 = r.column_id
), allIndx AS (
SELECT 'CREATE '+CASE WHEN is_unique = 1 THEN ' UNIQUE ' ELSE '' END+i.type_desc+' INDEX ['+i.name+'] ON ['+CAST(s.name COLLATE DATABASE_DEFAULT AS NVARCHAR )+'].['+o.name+'] (' as prefix,
CASE WHEN is_included_column = 0 THEN '['+c.name+'] '+CASE WHEN ic.is_descending_key = 1 THEN 'DESC' ELSE 'ASC' END END As cols,
CASE WHEN is_included_column = 1 THEN '['+c.name+']'END As incCols,
') WITH ('+
CASE WHEN is_padded = 0 THEN 'PAD_INDEX = OFF,' ELSE 'PAD_INDEX = ON,' END+
CASE WHEN ignore_dup_key = 0 THEN 'IGNORE_DUP_KEY = OFF,' ELSE 'IGNORE_DUP_KEY = ON,' END+
CASE WHEN allow_row_locks = 0 THEN 'ALLOW_ROW_LOCKS = OFF,' ELSE 'ALLOW_ROW_LOCKS = ON,' END+
CASE WHEN allow_page_locks = 0 THEN 'ALLOW_PAGE_LOCKS = OFF' ELSE 'ALLOW_PAGE_LOCKS = ON' END+
')' as suffix, index_column_id, key_ordinal, f.name as fileGroupName
FROM sys.indexes i
LEFT OUTER JOIN sys.index_columns ic
ON i.object_id = ic.object_id
AND i.index_id = ic.index_id
LEFT OUTER JOIN sys.columns c
ON ic.object_id = c.object_id
AND ic.column_id = c.column_id
INNER JOIN sys.objects o
ON i.object_id = o.object_id
AND o.type = 'U'
AND i.type <> 0
INNER JOIN sys.schemas s
ON o.schema_id = s.schema_id
INNER JOIN sys.filegroups f
ON i.data_space_id = f.data_space_id
), idxrCTE AS (
SELECT r.prefix, CAST(r.cols AS NVARCHAR(MAX)) AS cols, CAST(r.incCols AS NVARCHAR(MAX)) AS incCols, r.suffix, r.index_column_id, r.key_ordinal, fileGroupName
FROM allIndx r
WHERE index_column_id = 1
UNION ALL
SELECT o.prefix, COALESCE(r.cols,'') + COALESCE(', '+o.cols,''), COALESCE(r.incCols+', ','') + o.incCols, o.suffix, o.index_column_id, o.key_ordinal, o.fileGroupName
FROM allIndx o
INNER JOIN idxrCTE r
ON o.prefix = r.prefix
AND o.index_column_id - 1 = r.index_column_id
SELECT 'CREATE TABLE ['+sName+'].[' + oName + '] ('+bText+') ON [' + fileGroupName +']'
FROM rCTE r
WHERE column_id = (SELECT MAX(column_id) FROM rCTE WHERE r.oName = oName)
UNION ALL
SELECT prefix + cols + CASE WHEN incCols IS NOT NULL THEN ') INCLUDE ('+incCols ELSE '' END + suffix+' ON [' + fileGroupName +']'
FROM idxrCTE x
WHERE index_column_id = (SELECT MAX(index_column_id) FROM idxrCTE WHERE x.prefix = prefix)
Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

Similar Messages

  • Generate "create table" stmt based on oracle8.1.7 dictionary

    I plan to create a DEMO database as a copy of our production database. The storage allocation of the tables should in the DEMO database be much smaller than in the production one. I assume, I have to write an sql-script to export the table definitions from the oracle dictionary (oracle 8.1.7) generating CREATE TABLE statements, which are written to a flat file.
    Do you maybe already have a working solution?

    you can create a schema, then a dblink to the db you want to copy, set up your default sizings to the size you want in your DEMO database and then
    select
    'create table '||table_name||' as select * from '||table_name||'@dblink where 1=0;'
    from user_tables
    save and run the output.
    That's the way I do it sometimes. Hope that's handy enough.

  • Generating Create Table As Statements

    Hi all - just after a bit of guidance on the following procedure:
    I have identified various columns that need their numeric values upgrading during a cutover. These are stored in the table FOR_UPGRADE which contains the columns TABLE_NAME, COLUMN_NAME, and FACTOR, (the factor is assigned depending on the object type being upgraded and is used in the calculation to create the new 'upgraded' value for that column).
    My problem is that I'm dealing with very large volumes, (TBs) of data and speed is a key factor here. As such I've been asked to upgrade these using create table statements rather than updates, (I believe this was down to being able to turn almost all the logging off during creates, but not updates). So the plan would be to use CTAS a select from the existing table, but apply the upgrades based on the factor during this, then rename these upgraded tables to match the original.
    Now I'd rather not manually create 200+ of these create table statements so I was hoping someone could advise as to how I could use a combination of FOR_UPGRADE table and ALL_TABLE_COLS to dynamically output all the statements required.
    Any help greatly appreciated.

    Write one script manually and use it as a template to create other scripts.
    The easiest way would be loop through FOR_UPGRADE table
    - as soon as the table name changes you know that next statement starts and previous end so you should do something different than for all other rows.
    - for each column generate its part of insert statement and oputput for example using dbms_output.
    Question remains would you really need user/all_tab_columns view because as I've understood you have already all column names in FOR_UPGRADE table.
    In case you need it (for example to check data type or whatever) you can simply join it to your base cursor.
    With one template already created and a bit of PL/SQL it should not be that hard :)
    Gints Plivna
    http://www.gplivna.eu

  • Create Create table statement dynamicallly

    I am trying to create a SP that  return a “Create table  “statement dynamically using a table called “Employee” in database. How can I create a dynamic Create Table
    statement using sys.table? The create table statement should contains all the columns from Employee table.. i am using SQL server 2008 R2

    Hi SSAS_5000,
    If you don't care about the constraints,dependency on the Table Employee and what you'd like is the table structure, you may use the below statement where the create statement generated from the SP is executed.
    SELECT TOP 1 * INTO desiredTable FROM Eemploy;
    TRUNCATE TABLE desiredTable
    If you have question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • SQL Developer  Create Table Statement to ERD Visio Diagram

    I have the following Create table statement from SQL Developer and I am trying to generate an ERD Diagram using 2003 Visio. I was wondering what I need to do to convert the Create Table to an ERD Diagram Using Visio. Thanks
    CREATE TABLE “TT_TEAM”.”HR_REVOKED_SECURITY_ORGS”
    “ID” NUMBER NOT NULL ENABLE,
    “ACAT_CODE” VARCHAR2(6 BYTE) NOT NULL ENABLE,
    “APPR_SEQ_NO” NUMBER(3,0) NOT NULL ENABLE,
    “USER_ID” VARCHAR2(30 BYTE) NOT NULL ENABLE,
    “ACTION_IND” VARCHAR2(1 BYTE) NOT NULL ENABLE,
    “ACTIVITY_DATE” DATE NOT NULL ENABLE,
    “COAS_CODE” VARCHAR2(1 BYTE),
    “ORGN_CODE” VARCHAR2(6 BYTE),
    “POSN” VARCHAR2(6 BYTE) NOT NULL ENABLE,
    “MANDATORY_APPR_IND” VARCHAR2(1 BYTE),
    “APPR_POSN” VARCHAR2(6 BYTE),
    “ORGN_MANAGER” VARCHAR2(6 BYTE) NOT NULL ENABLE;

    I'm pretty Visio is a non-Oracle product.
    In the mean-time, you can easily import a DDL script file and create a relational model/diagram using SQL Developer. Use the Import feature and point to your CREATE TABLE script(s)

  • How to specify  tablespace for a primary key inde in create table statement

    How to specify the tablespace for a primary key index in a create table statement?
    Does the following statement is right?
    CREATE TABLE 'GPS'||TO_CHAR(SYSDATE+1,'YYYYMMDD')
                ("ID" NUMBER(10,0) NOT NULL ENABLE,
                "IP_ADDRESS" VARCHAR2(32 BYTE),
                "EQUIPMENT_ID" VARCHAR2(32 BYTE),
                "PACKET_DT" DATE,
                "PACKET" VARCHAR2(255 BYTE),
                "PACKET_FORMAT" VARCHAR2(32 BYTE),
                "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
                 CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") TABLESPACE "INDEX_DATA"
                 TABLESPACE "SBM_DATA";   Thank you
    Edited by: qkc on 09-Nov-2009 13:42

    As orafad indicated, you'll have to use the USING INDEX clause from the documentation, i.e.
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE TABLE GPS
      2              ("ID" NUMBER(10,0) NOT NULL ENABLE,
      3              "IP_ADDRESS" VARCHAR2(32 BYTE),
      4              "EQUIPMENT_ID" VARCHAR2(32 BYTE),
      5              "PACKET_DT" DATE,
      6              "PACKET" VARCHAR2(255 BYTE),
      7              "PACKET_FORMAT" VARCHAR2(32 BYTE),
      8              "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
      9               CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") USING INDEX TABLESP
    ACE "USERS"
    10               )
    11*              TABLESPACE "USERS"
    SQL> /
    Table created.Justin

  • Caculated column in a Create Table statement

    This is my create table statement:
    CREATE TABLE DTPartInv
    ( partinv_partnbr VARCHAR2(10) NOT NULL,
    partinv_prodname VARCHAR2(25),
    partinv_desc VARCHAR2(25),
    partinv_manufact VARCHAR2(25),
    partinv_instock INTEGER NOT NULL,
    partinv_category VARCHAR2(20),
    partinv_purchdate DATE,
    partinv_loc VARCHAR2(15),
    partinv_price NUMBER(6,2),
    partinv_vendor VARCHAR2(20),
    partinv_reorder INTEGER NOT NULL,
    partinv_serial VARCHAR2(20),
    partinv_flag as (case when partinv_instock < partinv_reorder then 'X' else 'O' end), calculated column
    CONSTRAINT DTPartInv_partinv_partnbr_pk
    PRIMARY KEY (partinv_partnbr)
    and these are my Insert into table statements:
    INSERT INTO DTPartInv VALUES('XT40010E',Null,'Exhaust Pipe','TMC Inc',2,'Pipes',TO_DATE('11-APR-10','DD-MON-RR'),Null,45.95,'Oracle Auto Parts',1,Null);
    INSERT INTO DTPartInv VALUES('CH9260',Null,'Oil Filter','Mechanical Parts',5,'Fuild Filters',TO_DATE('15-Jan-10','DD-MON-RR'),Null,20.00,'Sink Auto P',2,Null);
    INSERT INTO DTPartInv VALUES('15W40',Null,'Oil','Sink Oil',20,'Auto Fuilds',TO_DATE('10-Feb-11','DD-MON-RR'),Null,10.00,'Oracle Auto Parts',5,Null,);
    INSERT INTO DTPartInv VALUES('C9262',Null,'Fuel Filter','Mechanical Parts',2,'Fuild Filters',TO_DATE('20-Oct-10','DD-MON-RR'),Null,35.95,'Sink Auto Parts',1,Null);
    INSERT INTO DTPartInv VALUES('PS7716',Null,'Fuel/Water Separator','Mechanical Parts',4,'Fuild Filters',TO_DATE('09-Dec-10','DD-MON-RR'),Null,50.00,'Sink Auto Parts',1,Null);
    INSERT INTO DTPartInv VALUES('800142',Null,'PPI Valve','Beink Pipes Inc',10,'Valves',TO_DATE('01-Jun-11','DD-MON-RR'),Null,20.00,'Oracle Auto Parts',2,Null);
    INSERT INTO DTPartInv VALUES('TTS400',Null,'Butt Clamp','Beink Pipes Inc',10,'Valves',TO_DATE('31-Oct-11','DD-MON-RR'),Null,15.95,'Oracle Auto Parts',2,Null);
    INSERT INTO DTPartInv VALUES('TBA400',Null,'Lap Clamp','Beink Pipes Inc',10,'Valves',TO_DATE('10-Nov-11','DD-MON-RR'),Null,30.00,'Oracle Auto Parts',2,Null);
    INSERT INTO DTPartInv VALUES('SC16650',Null,'Brake pads','CostVB Mechanical',5,'Mechanical Parts',TO_DATE('15-May-11','DD-MON-RR'),Null,60.00,'Adosql Auto Parts',1,Null);
    INSERT INTO DTPartInv VALUES('OB46613',Null,'Emergency Door Latch','CostVB Mechanical',3,'Mechanical Parts',TO_DATE('01-Sep-11','DD-MON-RR'),Null,45.95,'Adosql Auto Parts',1,Null);
    And this is a sample of the error I'm geeting:
    INSERT INTO DTPartInv VALUES('XT40010E',Null,'Exhaust Pipe','TMC Inc',2,'Pipes',TO_DATE('11-APR-10','DD-MON-RR'),Null,45.95,'Oracle Auto Parts',1,Null)
    ERROR at line 1:
    ORA-00947: not enough values
    I need to figure out, what it is that I am missing here. partinv_flag is supposed to be calculated based on partinv_instock and partinv_reorder.

    You need to name columns:
      1  INSERT INTO DTPartInv
      2  (partinv_partnbr, partinv_prodname, partinv_desc, partinv_manufact, partinv_instock, partinv_category, partinv_purchdate,
      3  partinv_loc, partinv_price, partinv_vendor, partinv_reorder, partinv_serial)
      4* VALUES('XT40010E',Null,'Exhaust Pipe','TMC Inc',2,'Pipes',TO_DATE('11-01-10','DD-MM-RR'),Null,45.95,'Oracle Auto Parts',1,Null)
    SQL> /
    1 row created.
    SQL> select * from dtpartinv;
    PARTINV_PA PARTINV_PRODNAME          PARTINV_DESC
    PARTINV_MANUFACT          PARTINV_INSTOCK PARTINV_CATEGORY     PARTINV_
    PARTINV_LOC     PARTINV_PRICE PARTINV_VENDOR       PARTINV_REORDER
    PARTINV_SERIAL       P
    XT40010E                             Exhaust Pipe
    TMC Inc                                 2 Pipes                11/01/10
                            45,95 Oracle Auto Parts                  1
                         OEdited by: P. Forstmann on 21 nov. 2011 18:57
    Edited by: P. Forstmann on 21 nov. 2011 19:00

  • Create table statement from DatabaseMetaData

    Hi Experts,
    Do you know if it's possible to retrieve a create table statement based on a DatabaseMetaData ? (without looping through columnName / Type)
    The idea is to get the DatabaseMetaData from one db server, and execute the Create Table statements on a different db server.
    One obvious solution would be to loop through each table's column name/type and construct the create table statement manually, but I'd like to know whether this can be automated.
    Thanks in advnace,
    Sid

    Bigger databases provide a way to access most schema information from the database itself. That doesn't mean that the jdbc meta information is sufficient nor the best way to do that.
    There are existing tools that allow for migrations as well. Especially if the migration is a one to one mapping.

  • CREATE TABLE statement

    i am accessing the local database through JDBC for an application. but i've been getting "not allowed" errors while trying to execute a CREATE TABLE statement in my servlet. It allows all other statements like insert, delete, select etc. i've been using a default table because of the same reason.
    so if someone could please throw some light into it.

    Hi,
      Statements like Create which is a Data definition one
    will not be entertained by the program while executing.
    The reason being the DB cannot allocate the required buffer for crating a table at the time of execution.
      So the alterantive is create your DB table manually in ur Db and try other DML statements.
      Hope it helps.
    Regards,
    Guru

  • SQLPLUS - Create Table statement

    Hello gents/ladies.
    I have a few tables that I want to import from a DUMP file I have from MySQL. My quickie question : I've removed all the MySQL specific formatting ( I thought ) like Type=MYISAM and similar, and ended up with a CREATE TABLE statement that looks like this:
    CREATE TABLE customerdetails (
    custid NUMBER(11) NOT NULL auto_increment,
    uid_system varchar2(20) NOT NULL default '',
    pwd_system varchar2(20) NOT NULL default '',
    lastname varchar2(30) NOT NULL default '',
    firstname varchar2(30) NOT NULL default '',
    middleinitial char(1) default NULL,
    day_phone_countrycode char(3) default NULL,
    day_phone_main varchar2(16) default NULL,
    evening_phone_countrycode char(3) default NULL,
    evening_phone_main varchar2(16) default NULL,
    email_primary varchar2(80) NOT NULL default '',
    email_secondary varchar2(80) default NULL,
    street_adress varchar2(80) NOT NULL default '',
    state_prov char(3) NOT NULL default '',
    zipcode varchar2(11) NOT NULL default '',
    countrycode char(3) NOT NULL default '',
    PRIMARY KEY (custid),
    UNIQUE KEY UC_custid(custid),
    UNIQUE KEY IDX_system_uid(uid_system),
    KEY idx_lname_fname_mi(lastname,firstname,middleinitial),
    KEY IDX_day_phone(day_phone_countrycode,day_phone_main)
    I get this error back from SQLPLUS:
    CREATE TABLE CUSTOMERDETAILS (
    ERROR in line 1:
    ORA-00922: missing or invalid option
    I've read through the documentation, and can't see what I'm missing here. Could somebody PLEASE point out the obviously screaming error in this statement?
    Thanks!
    Kind regards,
    Henning Kilset Pedersen
    Funcom OSLO AS

    Hi Henning Pedersen,
    First of all the your query syntax is wrong.
    1. the keyword you used "auto_increment" is not in oracle. you need to take it out from query.
    2. you are saying some columns are not null but giving default value as '' (two quotes without any space), this is contradiction, since '' is null, this gives you an error.
    Need to take it out.
    3. the keyword UNIQUE KEY is wrong you need to use only UNIQUE.
    4. Another option is not correct it UNIQUE KEY IDX_system_uid(uid_system),
    it must be UNIQUE (uid_system)
    5. There is not any keyword as a KEY in oracle. you need to take it out from the query too.
    The final query will be like :
    CREATE TABLE customerdetails (
    custid NUMBER(11) NOT NULL ,
    uid_system varchar2(20) NOT NULL ,
    pwd_system varchar2(20) NOT NULL ,
    lastname varchar2(30) NOT NULL ,
    firstname varchar2(30) NOT NULL ,
    middleinitial char(1) default NULL,
    day_phone_countrycode char(3) default NULL,
    day_phone_main varchar2(16) default NULL,
    evening_phone_countrycode char(3) default NULL,
    evening_phone_main varchar2(16) default NULL,
    email_primary varchar2(80) NOT NULL ,
    email_secondary varchar2(80) default NULL,
    street_adress varchar2(80) NOT NULL ,
    state_prov char(3) NOT NULL ,
    zipcode varchar2(11) NOT NULL ,
    countrycode char(3) NOT NULL ,
    PRIMARY KEY (custid),
    UNIQUE (custid),
    UNIQUE (uid_system)---,
    ---KEY idx_lname_fname_mi(lastname,firstname,middleinitial),
    ---KEY IDX_day_phone(day_phone_countrycode,day_phone_main)
    This would work fine.
    Thanx
    Arvind.
    null

  • Error when generating create table script

    Hi,
    I am trying to generate create table script from an existing table. But I get the following error when doing so,
    ORA-20001: Rem Unable to generate DDL for ORA-06502: PL/SQL: numeric or value error ORA-31605: the following was returned from LpxXSLResetAllVars in routine kuxslResetParams: LPX-1: NULL pointer ORA-22921: length of input buffer is smaller than amount requested .
    Any suggestions on what could be wrong?
    Thanks.
    -B

    this is my bad, i should have updated this thread when we originally troubleshot this issue...
    that error you're getting on htmldb.oracle.com when you try to generate ddl for tables and such is a manifestation of a database bug (#3372908) that's recently been filed. checking the worklog for that bug suggests that those guys are still working out the issue. unfortunately, there's no current work-around on htmldb.oracle.com at the moment. if you want to generate ddl for your objects, you'd have to query the appropriate data dictionary views to get the info you need.
    ...i'll update the htmldb.oracle.com interface in a bit to prevent other users from hitting this issue. so you know, this is only an issue on db versions 9.2.0.3 and 9.2.0.4 running on some platforms and only (as far as i know) those using the AL32UTF8 characterset ...which does include our hosted site for now.
    hope this helps,
    raj

  • Mass create table statement

    Hi,
    I am facing the following problem:
    Database A is running with a great number of tables.
    Database B should contain the same tables as A with different data (DB B is empty at the moment).
    Therefore I've collected all the 'create table'-statements and packed them into a script.
    Because there are several foreign key constraints in DB A (not all deferrable) it seems to be a problem to execute the script.
    I have searched the internet how to disable constraints before executing the statements, but I' ve only found solutions for disabling constraints for allready existing tables - not disabling constraint checks will creating.
    So, could you please give me a hint what keywords I should use for my further search?
    Thanks in advance.

    steve sastro wrote:
    Thanks to all of you.
    The point is: I don't really like tools (where I have to click in GUIs). I prefer to see what's going on - just to learn what's happening behind.
    As soon as I have tested all of your topics I will reward you with the forum-points. Thx again.
    EDIT: Version is 10g
    Edited by: steve sastro on 07.12.2009 11:28Being an old-fart command line guy myself, I can appreciate that -- up to a point. But eventually it gets to be simply re-inventing the wheel.
    Use exp at the command line. Then use the 'strings' command to examine the output .dmp file. That will give you the education you seek.

  • Get Create Table Statements

    Hi,
    I'm using Oracle Db 10g.
    I want to take the create table statements of few tables.
    Is there any way to get that?
    Thanks

    You can use DBMS_METADATA package:
    select dbms_metadata.get_ddl('TABLE', 'TABLE_NAME') from dual;http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#ARPLS026
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1794096300346327738

  • Generate create table script?

    If I have a table called "customer" in my oracle database and I want to create the same table on another server. There are any way to generate Create table script to create this table?
    Thank you for your help.
    Regards,
    Kevin

    The documentation for the GET_DDL method in the DBMS_METADATA package is here
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_metad2.htm#1024701
    Basically, you'll want something like
    DECLARE
      l_clob CLOB;
    BEGIN
      l_clob := dbms_metadata.get_ddl( 'TABLE', '<<table name>>');
      <<Do something with the DDL>>
    END;Justin

  • Funktion for "Create Table" Statement

    Dear all,
    I am looking for a function to create a "create table"-SQL statement from an existing SAP Dictionary table. Does anybod y know a abap function to do this. With the SQL Statement I want to create the table in an external Database.
    Kind Regards
    Roman Becker

    Hi please enter db_create* in se37 and pick the desired function needed.
    here are few Function modules for u.
    DB_CREATE_TABLE
    DB_CREATE_TABLE_AS_SELECT
    DB_CREATE_TABLE_AS_SELECT_S
    DB_CREATE_TABLE_S              As DB_CREATE_TABLE, also returns the generated statements
    Satish

Maybe you are looking for

  • How to reuse the same disk (partition) for next ASM configuration?

    Hello All, I had successfully installed and configured ASM instance once, but I need to do a reinstallation and I would like to use the same disk (partition) as with previous ASM configuration. The disk path used was: /dev/rdsk/c1t3d0s7 I have to reg

  • Hello, cant clear songs from an Ipod shuffle.

    I have an Ipod shuffle that I am trying to clear the songs from and add new songs. When I try and clear the songs it tells me do not disconect and after a while it tells me the update was succesfull and I can disconect my Ipod Shuffle. The list appea

  • Database Adapter Failure - 10.1.3.1

    Added a database adapter in 10.1.3.1 to call a package which calls successfully from 10.1.2.0.2. When I run it under 10.1.3.1, I get an error saying that an element cannot be NULL, and on investigation I see that BPEL is adding in the wrong namespace

  • Retained earnings account fi

    Hello friends , can anybody help me .iam trying to create retained earning account in master data in img but the errors continously coming is (data can only be displayed -data is still being processed) its coming only in display mode not in change mo

  • Sales Delivery Reports. Fields

    Dear All Experts. I making a Sales Order Reports. Using Following Tables. VBEP , VBAP ,  VBPA , VBKD , VBAK , LIKP , LIPS , KNA1 I successfully Search Other Fields. But i cant Find exact field for PENDING QTY, PENDING WEIGHT, ORDER QTY, PENDING VALUE