Re: How to create a table with dynamic table name
Posted in 2003
I do this quite often, it involves constructing the (random) name first in
my application (Java) code.
Pseudocode follows
String tableNamePrefix="somePrefix";
String tableNameSuffix=(String)
getARandomNumberUsingInternalRandomFunction();
tableNameSuffix=trimOrPadRandomNumberToExactlyEightCharactersLong (
tableNameSuffix );
String command =
" create temp table " + tableNamePrefix + tableNameSuffix + " ( "
" col01 char(1), " +
" col02 char(2) " +
") with no log " ;
Execute ( command );
--John
202-502-2599 (or x 2599)
"cathy wang" <cathyyanwang@hotmail.com>
Sent by: owner-informix-list@iiug.org
07/16/2003 10:33 AM
To: informix-list@iiug.org
cc:
Subject: How to create a table with dynamic table name
Hello,<?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" />
For a web application, I need to create a table with a dynamic name. I
wonder if it is possible to have the following procedure created in
INFORMIX. If not, what is the proper way to handle this ? Thanks in
advance ! -Cathy
----------------------------------------------
Procedure to create table with dynamic
CREATE PROCEDURE sfa_newtable(tablename char)
Create TABLE tablename(
terr_nbr char(7),
act_date date,
form_nbr char(15),
fid integer,
fname char(35),
lname char(35),
addr1 char(40),
addr2 char(40),
addr3 char(40),
city char(30),
state char(2),
zipcode char(5),
descrip char(25),
);
END PROCEDURE
MSN 8 helps ELIMINATE E-MAIL VIRUSES. Get 2 months FREE*.
sending to informix-list
sending to informix-list